ajax无刷新上传文件MVC

@{
    ViewBag.Title = " Assistant";
    //Layout = null;
}






controller层

        [HttpPost]
        public ActionResult UploadFiles()
        {
            string path = Server.MapPath("~/WorkFolder/Upload/Inspection/");
            HttpFileCollectionBase files = Request.Files;
            for (int i = 0; i < files.Count; i++)
            {
                HttpPostedFileBase file = files[i];
                file.SaveAs(path + file.FileName);
            }
            return Json(files.Count + " Files Uploaded!");
        }


你可能感兴趣的:(MVC4,WEB前端)