zoukankan      html  css  js  c++  java
  • 创建临时文件及删除的方法

    //文件名

     string fName = string.Format("{0}{1}", DateTime.Now.ToString(CommonDefine.DATETIME_FORMAT_LIST),
                               this.fUpload.PostedFile.FileName.Substring(this.fUpload.PostedFile.FileName.LastIndexOf(".")));
                        if (!Directory.Exists(Server.MapPath("XSL")))
                        {
                            Directory.CreateDirectory(Server.MapPath("XSL"));
                        }
                        string path = Server.MapPath(string.Format("XSL\{0}", fName));//待读取Excel的全路径,临时文件路径
                        this.fUpload.PostedFile.SaveAs(path);//将上传文件重新保存在XSL临时文件夹下

    //do sth

    //删除临时文件

       //把上传的文件删除
                        if (File.Exists(Server.MapPath(string.Format("XSL\{0}", fName))))
                        {
                            File.Delete(Server.MapPath(string.Format("XSL\{0}", fName)));
                        }

  • 相关阅读:
    php获取OS信息
    坑爹的IE quirk模式
    [转]mysql privileges
    [转]VSFTPD的设置选项
    php性能分析工具xhprof
    php扩展安装
    又是万恶的IE....6
    ASP.NET操作文件(文件夹)简单生成html操作示例
    asp.net文件操作类
    c++/clr与c#的性能比较
  • 原文地址:https://www.cnblogs.com/Chinarain/p/3822047.html
Copyright © 2011-2022 走看看