Why I get null value in input file when return model to view?
this my model:
public class BookViewModel
{
public string Author{ get; set; }
public HttpPostedFileBase Book { get; set; }
}
this my Controller:
[HttpPost]
public ActionResult UploadBook(BookViewModel model)
{
// DO Stuff
return View(model);
}
this my View:
@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"/>
}
Now, when I submit, the model the file upload but when return to view it return null why. please help me.
Thanks.