Is there a HTMLHelper
for file upload? Specifically, I am looking for a replace of
<input type="file"/>
using ASP.NET MVC HTMLHelper.
Or, If I use
using (Html.BeginForm())
What is the HTML control for the file upload?
Is there a HTMLHelper
for file upload? Specifically, I am looking for a replace of
<input type="file"/>
using ASP.NET MVC HTMLHelper.
Or, If I use
using (Html.BeginForm())
What is the HTML control for the file upload?
HTML Upload File ASP MVC 3.
Model: (Note that FileExtensionsAttribute is available in MvcFutures. It will validate file extensions client side and server side.)
HTML View:
Controller action:
Or you could do it properly:
In your HtmlHelper Extension class:
This line:
Generates an id unique to the model, you know in lists and stuff. model[0].Name etc.
Create the correct property in the model:
Then you need to make sure your form will send files:
Then here's your helper: