Null file when uploading via MVC
Posted
by Josh
on Stack Overflow
See other posts from Stack Overflow
or by Josh
Published on 2010-06-15T19:37:27Z
Indexed on
2010/06/15
19:42 UTC
Read the original article
Hit count: 328
I have the following form on an .NET MVC View:
<form method="post" enctype="multipart/form-data" action="/Video/UploadDocument">
<input type="file" id="document1" name="document1"/>
<input type="submit" value="Save"/>
</form>
And the controller has the following signature that gets called:
public ActionResult UploadDocument(HttpPostedFileBase file) {
return View();
}
When I break inside the UploadDocument method, the parameter 'file' is null. I've selected a valid document on my desktop and know it contains text. What am I missing to get this file upload working?
© Stack Overflow or respective owner