How to upload file in ASP.Net MVC
Posted by Anuraj on Tuesday, May 6, 2014
.Net .Net 4.0 ASP.Net MVC
This post is about upload file to server using ASP.Net MVC 4. First you need to modify the controller to accept the posted file along with the model. So you can modify it like this.
And in View, you need to include htmlAttribute to upload files.
Make sure the parameter name in the action method and File upload control id is same, otherwise it may not work.
Instead on including the HttpPostedFileBase parameter in the action method, you can also use Request.Files collection. Here is the implementation using Request.Files.
Happy Programming :)