When posting back to my controller my model is populated with correct values and my string field has the file name, but Request.Files is empty.
My input at the view is:
<input id="SitePlan" name="SitePlan" type="file" value="<%= Html.Encode(Model.SitePlan) %>" />
My form tag begins with:
<% using (Html.BeginForm(new { enctype = "multipart/form-data" }))
Is there anything else I need to set to send the field back to the controller?
Have a look at the the <form> tag that is rendered. There is no Html.BeginForm declaration that just takes in the htmlAttributes that you are using. In fact, it uses the html attributes as routeValues. Try this...
<% using (Html.BeginForm("actionName", "controllerName", FormMethod.Post,
new { enctype = "multipart/form-data" })) { %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With