[HttpPost]
        public ActionResult MultiUpload()
        {
            System.Web.HttpFileCollectionBase files = Request.Files;
            //for (var i = 2; i < files.Count; i++)
            HttpPostedFileBase postFile = files[1];
            string fileName = System.IO.Path.GetFileName(postFile.FileName);
            if (postFile != null)
            {
                if (postFile.ContentLength > 0)
                {
                    string filePath = postFile.FileName;
                    string filename2 = Guid.NewGuid().ToString();
                    string filename = filename2 + filePath.Substring(filePath.LastIndexOf('.'), filePath.Length - filePath.LastIndexOf('.'));
                    //设定上传路径(绝对路径)
                    string upPath = Server.MapPath("~/") + AppConfig.UploadConfig.VideoFiles + "\\" + filename;
                    if (System.IO.File.Exists(upPath))
                    {
                        System.IO.File.Delete(upPath);
                    }
                    //文件上传到绝对路径                  
                    postFile.SaveAs(upPath);
                    string savePath = "\\" + AppConfig.UploadConfig.VideoFiles + "\\" + filename;
                }
            }
            return RedirectToAction("Index");
        }

最新文章

  1. Ubuntu学习总结-10 XManager
  2. Genymotion无法下载OVA文件
  3. 【poj2773】 Happy 2006
  4. Python中__init__方法/__name__系统变量讲解
  5. [iOS]URL编码和解码
  6. Angular form
  7. [SVN]常见问题的解决方案
  8. CC 3-Palindromes(manacher)
  9. nodejs 全局变量和全局对象
  10. Servlet实现后台分页查询
  11. spring中ref属性与&lt;ref/&gt;标签
  12. 01 深入理解JVM的内存区域
  13. C# [Win32] [GDI+] [API] Load HFONT from Memory
  14. 常用的CMD &amp; Linux命令
  15. ROS * 了解xacro的编写
  16. 浅谈DP
  17. 2019.02.12 bzoj5294: [Bjoi2018]二进制(线段树)
  18. C# Winform下一个热插拔的MIS/MRP/ERP框架(简介)
  19. 洛谷P2045 方格取数加强版(费用流)
  20. 关于Unity中Shader的使用

热门文章

  1. MYSQL强制使用索引和禁止使用索引
  2. OO的片段,继承与组合,继承的优点与目的,虚机制在构造函数中不工作
  3. Linux 高精度定时器hrtimer 使用示例【转】
  4. jquery清空div里所有input输入框的值
  5. Android Studio 3.0.1模拟器启动报错Emulator: glClear:466 GL err 0x502
  6. [Silverlight 2.0 控制物体绕圆弧运行(C#初探篇)]
  7. Getting Started with the Intel Media SDK
  8. maven实战(4)-- maven构建自己的jar到本地仓库中
  9. [SoapUI] Read data from response , use it to update parameter
  10. iOS添加弹出菜单