views:

1081

answers:

2

when posting back to my controller my model is populated with correct valeus and my string filed has the file name, but the 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 needing set to send the fiel back to the controller?

+1  A: 

check out this post

Uploading files

griegs
+3  A: 

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" })) { %>
David Liddle