C# 根据路径删除文件

前言

做功能模块时需要...原文

具体代码

public static void DeleteFile(string fileUrl)
{
    string file = System.Web.HttpContext.Current.Server.MapPath(fileUrl);
    if (System.IO.File.Exists(file))
    {
       System.IO.File.Delete(file);
    }
}

亲测有效。

原文地址:https://www.cnblogs.com/ZengJiaLin/p/14473602.html