ASP.NET MVC: when posted Upload File, it is null in action method
Posted
by Spencer
on Stack Overflow
See other posts from Stack Overflow
or by Spencer
Published on 2009-02-13T00:16:40Z
Indexed on
2010/06/05
6:52 UTC
Read the original article
Hit count: 290
In the View page, code is below:
<% =Html.BeginForm("About", "Home", FormMethod.Post, new {enctype="multipart/form-data "})%>
<input type ="file" name ="postedFile" />
<input type ="submit" name ="upload" value ="Upload" />
<% Html.EndForm(); %>
In the Controller, something like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult About(HttpPostedFile postedFile)
{
//but postedFile is null
View();
}
But postedFile is null, how to do it?
© Stack Overflow or respective owner