I\'m trying to upload multiple images on one form
@using (Html.BeginForm(\"Create\", \"AdminRestaurants\", FormMethod.Post, new { enctype = \"multipart/form-data
This would only work if your file inputs had indexed names like files[0]
, files[1]
, files[2]
,...
In order to understand how model binding to a list works in asp.net mvc, I recommend that you read this post: Model Binding to a List
You don't even have to use model binding to get the files. Use Request.Files
in your Action to get them.
public ActionResult Create(EventsModel collection)
{
var files = Request.Files;
// rest of the code...
}