zoukankan      html  css  js  c++  java
  • asp.net关于上传文件修改文件名的方法

    我这里主要用到了文件的复制方法

     string SavesUPLoadPath = ConfigurationManager.AppSettings["AWUploadLocation"] + CompanyName + "/";
                            string copySavesUPLoadPath = ConfigurationManager.AppSettings["AWUploadLocation"] + CompanyName + "/";
                            if (!Directory.Exists(SavesUPLoadPath))//判断上传文件夹是否存在,若不存在,则创建
                            {
                                Directory.CreateDirectory(SavesUPLoadPath);//创建文件夹
                            }

                         
                            SavesUPLoadPath = SavesUPLoadPath + FileUpload1.FileName;
                            FileUpload1.SaveAs(SavesUPLoadPath);
                            string NewSaveUPLoadPath = copySavesUPLoadPath + txtRefNO.Text + "-" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" + DateTime.Now.Hour + "-" + DateTime.Now.Minute + ".pdf";
                            File.Copy(SavesUPLoadPath, NewSaveUPLoadPath);   ---------把文件赋给新的 //复制文件的作用
                            File.Delete(SavesUPLoadPath); --在删除原来的
                            Response.Write(NewSaveUPLoadPath);
                         
                            labeMess.Text = GetGlobalResourceObject("public", "UpLoadPdfsucceed").ToString();
                            btnSearch.Enabled = false;
                            btnUpLoadFile.Enabled = false;
                           

  • 相关阅读:
    java并发之CountDownLatch
    在字符串中找出连续最长的数字串
    201301 JAVA题目0-1级
    linux vi 快捷键
    并行流水线、搜索、排序
    JDK中的Future模式
    Disruptor
    Unsafe类 AtomicReference AtomicStampedReference AtomicIntegerArray AtomicIntegerFieldUpdater vector SynchronousQueue
    java 虚拟机 分区 及 GC
    java 虚拟机对锁对优化
  • 原文地址:https://www.cnblogs.com/yzenet/p/2695591.html
Copyright © 2011-2022 走看看