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

  • 相关阅读:
    JSDoc使用指南
    听创始人讲Quora为什么选择Python
    Bootstrap model模态框与百度地图API发生冲突时的解决办法
    使用百度地图API制作线路轨迹播放
    EF+Mysql+DDD框架搭建(一)——code first准备
    RowNumber()分页方法
    设计模式六大原则
    温习.net基础知识(二)装箱和拆箱
    温习.net基础知识(一)基础知识点
    c# 跨域api
  • 原文地址:https://www.cnblogs.com/hanxingli/p/8669694.html
Copyright © 2020-2023  润新知