首页 > 其他 > 详细

文件处理

时间:2018-08-24 15:32:15      阅读:162      评论:0      收藏:0      [点我收藏+]

一丶删除文件

技术分享图片
 1  public string DelFile(string fileRelativePath)
 2         {
 3 
 4             try
 5             {
 6                 string filePath = Server.MapPath("~" + fileRelativePath);
 7 
 8                 //if (System.IO.File.Exists(filePath))
 9                 //{
10                 //    System.IO.File.Delete(filePath);
11                 //}
12 
13                 FileInfo file = new FileInfo(filePath);
14                 if (file.Exists)
15                 {
16                     file.Delete();
17                 }
18 
19                 return "";
20             }
21             catch (Exception)
22             {
23 
24                 throw;
25             }
26         }
删除

 

文件处理

原文:https://www.cnblogs.com/chenze-Index/p/9529996.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!