You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you have multiple file input elements, and one or more are empty, those empty elements are not handled correctly.
One could argue that empty file input elements should not be passed to the server (disabling them is one method), but this is a subtle issue that caused us some headaches while trying to find a minimal test case.
At least in one environment this causes an issue: ASP.NET MVC 4.
The files are uploaded (they can be observed with Request.Files) but model binding fails and you end up with an empty IEnumerable<HttpPostedFileBase>.
Below is the test page and Fiddler logs from Chrome 26. Firefox 20 and IE 10 have the same behaviour.
Summarised, the difference is that a regular form submit uses Content-Type: application/octet-stream for the empty element while ajaxSubmit() is missing Content-Type.
When you have multiple file input elements, and one or more are empty, those empty elements are not handled correctly.
One could argue that empty file input elements should not be passed to the server (disabling them is one method), but this is a subtle issue that caused us some headaches while trying to find a minimal test case.
At least in one environment this causes an issue: ASP.NET MVC 4.
The files are uploaded (they can be observed with
Request.Files
) but model binding fails and you end up with an emptyIEnumerable<HttpPostedFileBase>
.Below is the test page and Fiddler logs from Chrome 26. Firefox 20 and IE 10 have the same behaviour.
Summarised, the difference is that a regular form submit uses
Content-Type: application/octet-stream
for the empty element whileajaxSubmit()
is missingContent-Type
.test page
Chrome regular
Chrome ajaxSubmit()
The text was updated successfully, but these errors were encountered: