I came across the following issue: I have this model
public class Region
{
public int RegionID { get; set; }
public string RegionName { get; set; }
public HttpPostedFile CustomFile { get; set; }
}
and I have a custom extension html helper method from here.
Now in the view I have the following code:
<%using (Html.BeginForm("ModifyRegion", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{%>
<%: Html.TextAreaFor(x => x.RegionID, Model.RegionID)%>
<br />
<%: Html.TextAreaFor(x => x.RegionName, Model.RegionName)%>
<br />
<%: Html.FileBoxFor(x=>x.CustomFile, Model.CustomFile) %>
<input type="submit" />
When it reaches my controller action the CustomFile field is empty, but all other fields are properly set. If I change the CustomFile property to string instead of HttpPostedFile, I get correctly the file name ("dog.jpg" for example). Is there any way to get the full HttpPostedFile file correctly?
Thanks in advance, Tamash