码迷,mamicode.com
首页 > Web开发 > 详细

多个上传

时间:2019-01-20 11:49:28      阅读:185      评论:0      收藏:0      [点我收藏+]

标签:turn   load   app   dir   path   str   get   pre   pos   

public ActionResult Index(IEnumerable<HttpPostedFileBase> files) {
  foreach (var file in files) {
    if (file.ContentLength > 0) {
      var fileName = Path.GetFileName(file.FileName);
      var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
      file.SaveAs(path);
    }
  }
  return RedirectToAction("Index");
}

多个上传

标签:turn   load   app   dir   path   str   get   pre   pos   

原文地址:https://www.cnblogs.com/Kirins/p/10294088.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!