User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0
Sending a Blob with FormData, and empty filename is sent:
var blob = file.slice(0, 10);
var formData = new FormData();
This gets send to the server:
Content-Disposition: form-data; name="file"; filename=""
Sending an empty filename for a multipart file results in errors on some backends,
i.e. Django does not recognize this as a file. and treats it as a key/value POST instead.
Chrome sends this instead:
Content-Disposition: form-data; name="file"; filename="Blobf98dc705ce2d4f82af47b470950a3c2c"
Firefox should also set a random value for filename since this is expected by many multipart parsers.
Created attachment 526515 [details]
Testcase for this bug (should be loaded from a non-file:/// url)
This test case shows a file input, and when a file gets selected tries to upload the first Kb of that file to the current URL.
The file can't be opened directly, as POSTs to "file:" urls gets denied. Open from a local server instead.
Watching the sent data with a sniffer yelds the results Jan Gerber comments, with a filename="" on the POST. This causes PHP (and others) to reject the file, even if data was sent correctly.
Ugh. This needs to be specified in the spec for FormData :(
Is sending an empty string allowed according to the rfcs describing multipart/form-data?
Jonas, what do you need to make progress? Can you or Arun do the spec work required?
The spec side is blocked by Anne who is on a looooong trek. Suspect we should do this one ourselves.
Buried in sheriff stuff right now, but would love help remembering to fix this monday.
(In reply to comment #5)
> Buried in sheriff stuff right now, but would love help remembering to fix
> this monday.
Which monday were you talking about? :)
Any, really :)
Hi. Last update was 22 days ago.
Created attachment 542696 [details] [diff] [review]
Patch to fix
Comment on attachment 542696 [details] [diff] [review]
Patch to fix
Review of attachment 542696 [details] [diff] [review]:
Checked in. Thanks for the quick review!
This was fixed in Firefox 7.
And mentioned on Firefox 7 for developers.
*** Bug 680423 has been marked as a duplicate of this bug. ***
As visible here: https://tbpl.mozilla.org/php/getParsedLog.php?id=6407277&full=1
the test referenced in this bug (content/base/test/fileutils.js) has passed.