I want to upload file in asp.net-mvc. How can I upload
the file using html input file control?
How to File Upload ASP.NET MVC 3
Ask by Mark Devid
Updated 02 Feb 2015
You don't use a file input control. Server side controls are not used in ASP.NET MVC. Checkout thefollowing blog post which illustrates how to achieve this in ASP.NET MVC.
So you would start by creating an HTML form which would contain a file input:
@using (Html.BeginForm("Index", "Home", FormMethod.Post, new { enctype = "multipart/form-data" })){
<input type="file" name="file" />
<input type="submit" value="OK" />
}
and then you would have a controller to handle the upload: