Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty Request.Files with MVC 3 file upload

Tags:

asp.net-mvc

This is my markup:

<form action="/Customer/Create" enctype="multipart/form-data" method="post">
    <input id="file" type="file" style="width:300px" />
    <input type="submit" id="btnSubmit" value="Add Image to S3" />
</form>

When I step through the Create action the Request.Files is empty. I've searched and searched and all the advice seems to be about ensuring the enctype is set to "multipart/form-data" which I have already set. Any other ideas?

like image 978
user427875 Avatar asked Jan 05 '11 23:01

user427875


1 Answers

Try adding a name attribute to the input. I don't think nameless form items get posted at all.

like image 156
Jacob Avatar answered Nov 11 '22 09:11

Jacob