Closed
Bug 649150
Opened 13 years ago
Closed 13 years ago
Blobs do not have a filename if sent via FormData
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
VERIFIED
FIXED
mozilla7
People
(Reporter: j, Assigned: sicking)
References
Details
(Keywords: dev-doc-complete, testcase)
Attachments
(2 files)
1.08 KB,
text/html
|
Details | |
1.79 KB,
patch
|
mounir
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (X11; Linux i686; rv:2.0) Gecko/20100101 Firefox/4.0 Build Identifier: Sending a Blob with FormData, and empty filename is sent: var blob = file.slice(0, 10); var formData = new FormData(); formData.append('file', blob); 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. Reproducible: Always
Updated•13 years ago
|
Keywords: testcase-wanted
Comment 1•13 years ago
|
||
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.
Reporter | ||
Updated•13 years ago
|
Summary: FormatData of Blob does not set a filename → Blobs do not have a filename if send via FormData
Assignee | ||
Updated•13 years ago
|
Summary: Blobs do not have a filename if send via FormData → Blobs do not have a filename if sent via FormData
Assignee | ||
Comment 2•13 years ago
|
||
Ugh. This needs to be specified in the spec for FormData :(
Reporter | ||
Comment 3•13 years ago
|
||
Is sending an empty string allowed according to the rfcs describing multipart/form-data?
Comment 4•13 years ago
|
||
Jonas, what do you need to make progress? Can you or Arun do the spec work required?
Assignee | ||
Comment 5•13 years ago
|
||
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.
Comment 6•13 years ago
|
||
(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? :)
Assignee | ||
Comment 7•13 years ago
|
||
Any, really :)
Assignee: nobody → jonas
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Comment 8•13 years ago
|
||
Hi. Last update was 22 days ago.
Assignee | ||
Comment 9•13 years ago
|
||
Attachment #542696 -
Flags: review?(mounir.lamouri)
Comment 10•13 years ago
|
||
Comment on attachment 542696 [details] [diff] [review] Patch to fix Review of attachment 542696 [details] [diff] [review]: -----------------------------------------------------------------
Attachment #542696 -
Flags: review?(mounir) → review+
Assignee | ||
Comment 11•13 years ago
|
||
Checked in. Thanks for the quick review! http://hg.mozilla.org/mozilla-central/rev/c48c74bc146b
Comment 12•13 years ago
|
||
So fixed?
Assignee | ||
Comment 13•13 years ago
|
||
Yes!
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla7
Comment 15•13 years ago
|
||
Documentation updated: https://developer.mozilla.org/en/DOM/XMLHttpRequest/FormData https://developer.mozilla.org/en/DOM/XMLHttpRequest/Using_XMLHttpRequest#Sending_files_using_a_FormData_object And mentioned on Firefox 7 for developers.
Keywords: dev-doc-needed → dev-doc-complete
Keywords: testcase-wanted → testcase
Comment 17•12 years ago
|
||
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.
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•