How do I upload files in several file upload fields and send them to the controller?
Here is my code - what is wrong with it?
.cshtml file
@using (Html.BeginForm("UploadFile", "Upload", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div>
@Html.TextBox("log", "", new { type = "file"}) <br />
</div>
<div>
@Html.TextBox("rpa", "", new { type = "file" }) <br />
</div>
<div>
@Html.TextBox("birth", "", new { type = "file" }) <br />
</div>
<div>
<input type="submit" value="Upload" />
@ViewBag.Message
</div>
}
Controller:
[HttpPost]
public ActionResult UploadFile(HttpPostedFileBase file)
{
}