How would I go about adding enctype="multipart/form-data"
to a form that is generated by using <% Html.BeginForm(); %>
?
views:
14062answers:
2
+36
A:
As part of htmlAttributes,e.g.
Html.BeginForm(action,controller, FormMethod.Post, new { enctype="multipart/form-data"})
liggett78
2008-10-19 16:20:13
Just as a note, you can pass null for action and controller to get the same default target that BeginForm() without parameters gives.
cantabilesoftware
2010-09-13 13:26:41
+8
A:
You can also use the following syntax for the strongly typed version:
<% using (Html.BeginForm<SomeController>(x=> x.SomeAction(),
FormMethod.Post,
new { enctype = "multipart/form-data" }))
{ %>
dp
2008-11-20 04:15:48
Which is a massive bummer :( So how can we do this? do we need another dll? MVC futures or something?
Pure.Krome
2009-04-25 01:35:37
Yes, indeed...I believe all of the strongly typed (expression-based) methods are in the futures assembly (http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24471).
dp
2009-04-25 08:50:26