Upload Multiple Files in MVC4

Create a new MVC Project (Internet Application).
 
Add a new Controller, Name it as "file". Write the following code in it.
  1. public ActionResult file()   
  2. {  
  3.     return View();  
  4. }  
  5. [HttpPost]  
  6. public ActionResult file(IEnumerable < HttpPostedFileBase > file)   
  7. {  
  8.     for (int i = 0; i < Request.Files.Count; i++)   
  9.     {  
  10.         if (Request.Files[i] != null && Request.Files[i].ContentLength > 0) try {  
  11.             string path = Path.Combine(Server.MapPath("~/Content/Files"),  
  12.             Path.GetFileName(Request.Files[i].FileName));  
  13.             Request.Files[i].SaveAs(path);  
  14.             ViewBag.Message = "File uploaded successfully";  
  15.         } catch (Exception ex) {  
  16.             ViewBag.Message = "ERROR:" + ex.Message.ToString();  
  17.         } else {  
  18.             ViewBag.Message = "You have not specified a file.";  
  19.         }  
  20.     }  
  21.     return View();  
  22. }  
Right click on the file method name and create a view named "file".
  1. View------ > file.cshtml  
  2.  Add the following code in the View: -  
  3.   
  4. @ {  
  5.     ViewBag.Title = "file";  
  6. } < h2 > Upload file < /h2>  
  7. t;br/ > @using(Html.BeginForm("file""file", FormMethod.Post,  
  8. new {  
  9.     enctype = "multipart/form-data"  
  10. })) { < input type = "file"  
  11.     name = "file"  
  12.     id = "file"  
  13.     multiple = "multiple" / > < br / > < input type = "submit"  
  14.     value = "Upload file" / > < br / > < br / > @ViewBag.Message  
Note
 
In the controller, dont forget to add "using System.IO;"  reference Also add a new folder named "Files" in the content folder of the project. Refer the attached file in case u find any difficulties.