I am using .net mvc and are uploading files to
public IEnumerable<HttpPostedFileBase> SubmissionUploadFiles { get; set; }
.net mvc puts the files nicely into that variable and it works with both one and multiple files.
But here is the odd thing, if I have 3 inputs and I leave one empty then chrome will send this:
------WebKitFormBoundaryU3zJOb5diOM9JOaS
Content-Disposition: form-data; name="SubmissionUploadFiles"; filename="Glidecam.jpg"
Content-Type: image/jpeg
------WebKitFormBoundaryU3zJOb5diOM9JOaS
Content-Disposition: form-data; name="SubmissionUploadFiles"; filename="fire.svg"
Content-Type: image/svg+xml
------WebKitFormBoundaryU3zJOb5diOM9JOaS
Content-Disposition: form-data; name="SubmissionUploadFiles"
As you see the last one has no value (as I did not select a file in that input!
Here is a screenshot showing graphically my 3 inputs
When one is empty like this the following happens in .net mvc i get one null file like so
However if I select 3 files (or add more - i add inputs with jquery) then it works great as you can see here.
I change nothing it's only if I have an empty file input or not. I can of course with jquery on submit remove empty fields as a workaround but i just think it's odd and would like a better solution.