Why I get null value in input file when return model to view? this my model: <pre lang="C#">public class BookViewModel { public string Author{ get; set; } public HttpPostedFileBase Book { get; set; } }
[HttpPost] public ActionResult UploadBook(BookViewModel model) { // DO Stuff return View(model); }
@using (Html.BeginForm("UploadBook", "Home", FormMethod.Post, new { enctype = "multipart/form-data" })) { @Html.TextBoxFor(m => m.Author) <br /><br /> <input type="file" name="Book" /><br /> <input type="submit" value="submit me"/> }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)