File - 删除文件

try
{
//删除临时上传的Excel文件
if (System.IO.File.Exists(path))
{
FileInfo fi = new FileInfo(path);
if (fi.Attributes.ToString().IndexOf("ReadOnly") != -1)
fi.Attributes = FileAttributes.Normal;
System.IO.File.Delete(path);
}
}
catch { }

posted @ 2023-07-03 15:31  jxw_29  阅读(24)  评论(0)    收藏  举报