• net 上传视频


         [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");
            }

  • 相关阅读:
    Java 常见关键字总结:final、static、this、super!
    URI与URL傻傻分不清楚?
    深入TLS/SSL协议
    排球计分软件功能(记分员计分功能)
    观《罗辑思维之怎样成为一个高手》有感
    个人项目制作(PSP)
    计应152班第3小组之软件初步开发(小组项目)
    本周个人总结
    本周个人总结(软件的初步开发)
    计应152班第3小组之软件初步开发(小组项目)
  • 原文地址:https://www.cnblogs.com/hanxingli/p/8669694.html
Copyright © 2020-2023  润新知