zoukankan      html  css  js  c++  java
  • 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");
            }

  • 相关阅读:
    python 单例模式
    socketserver 多进程、多线程应用实例
    socket 编程的一些应用例子
    模拟一个http 请求的json格式报文,带 rsa 签名操作
    python excel基本操作
    多线程 进程间共享变量等
    多线程 multiprocessing 的几个小例子
    mysql 数据库的相关操作
    正则表达式匹配IP地址
    32-服务的容量规划:怎样才能做到有备无患
  • 原文地址:https://www.cnblogs.com/hanxingli/p/8669694.html
Copyright © 2011-2022 走看看