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");
}
最新文章
- Ubuntu学习总结-10 XManager
- Genymotion无法下载OVA文件
- 【poj2773】 Happy 2006
- Python中__init__方法/__name__系统变量讲解
- [iOS]URL编码和解码
- Angular form
- [SVN]常见问题的解决方案
- CC 3-Palindromes(manacher)
- nodejs 全局变量和全局对象
- Servlet实现后台分页查询
- spring中ref属性与<;ref/>;标签
- 01 深入理解JVM的内存区域
- C# [Win32] [GDI+] [API] Load HFONT from Memory
- 常用的CMD &; Linux命令
- ROS * 了解xacro的编写
- 浅谈DP
- 2019.02.12 bzoj5294: [Bjoi2018]二进制(线段树)
- C# Winform下一个热插拔的MIS/MRP/ERP框架(简介)
- 洛谷P2045 方格取数加强版(费用流)
- 关于Unity中Shader的使用
热门文章
- MYSQL强制使用索引和禁止使用索引
- OO的片段,继承与组合,继承的优点与目的,虚机制在构造函数中不工作
- Linux 高精度定时器hrtimer 使用示例【转】
- jquery清空div里所有input输入框的值
- Android Studio 3.0.1模拟器启动报错Emulator: glClear:466 GL err 0x502
- [Silverlight 2.0 控制物体绕圆弧运行(C#初探篇)]
- Getting Started with the Intel Media SDK
- maven实战(4)-- maven构建自己的jar到本地仓库中
- [SoapUI] Read data from response , use it to update parameter
- iOS添加弹出菜单