Closed Bug 132069 Opened 22 years ago Closed 22 years ago

multipart/form-data form submission doesn't send filename form key if no file is uploaded

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

VERIFIED DUPLICATE of bug 133453
Future

People

(Reporter: bchen1688, Assigned: john)

Details

(Keywords: regression)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:0.9.9) Gecko/20020310
BuildID:    2002031005

In a multipart/form-data FORM post with a "FILE" input tag, the "filename"
attribute is not sent if no file is selected in the form. This behaves
differently than IE and Netscape 4.7x. The following are the content sent by
various browsers with MailingList being the upload form key and no file selected
for upload.

Mozillar 0.99
-----------------------------113673005417031^M
Content-Disposition: form-data; name="MailingList"^M
^M      
^M
-----------------------------113673005417031^M
IE Mac 5.1.3

-----------------------------141511461516657^M
Content-Disposition: form-data; name="MailingList"; filename=""^M
^M
^M
-----------------------------141511461516657^M

Netscape 4.7x on Win2000
-----------------------------3040467758554^M
Content-Disposition: form-data; name="MailingList"; filename=""^M
^M
^M
-----------------------------3040467758554^M



Reproducible: Always
Steps to Reproduce:
Create a multipart/form-data FORM with a file input field and submit to a cgi
program which prints out the content. Compare the content generated by Mozillar
with IE and Netscape 4.7 when submitting the form with no file selected.

Actual Results:  Mozillar doesn't send the "filename" form key while the other
browsers do

Expected Results:  They should send the same form keys.
reassigning to John. 

(I think this is platform = all, also i set future/P3 but if is a regression I
think we should prioritize it for sooner handling)
Assignee: alexsavulov → jkeiser
Priority: -- → P3
Target Milestone: --- → Future
Status: UNCONFIRMED → NEW
Ever confirmed: true
Actually, y'know what?  I don't think we should send a filename if there is no
file.  It's misleading.  Point me to a spec that says we should, or even
indicates that it is *valid* to have a filename without sending a file or file data.
This is really a compatibility issue with other browsers which can cause parsing
problems for app servers because all the other browsers except Mozilla sends the
empty filename form key. For example, WebObjects uses the presence of "filename"
form key to determine if the form value should be encoded to String or Data. Not
having the "filename" caused a class cast exception on the back end as the app
server encodes the empty content into String instead of Data. In form
submissions, form keys for form elements with nothing in it got submitted with
empty values, so I think the "filename" should be submitted even though no file
is selected to be consistent with other form elements as "filename" should be
treated just like another form element.
Keywords: regression
OS: MacOS X → All
Hardware: Macintosh → All
This bug really breaks compatibility with many application servers and I think 
it should be prioritized higher. I think feature has been working correctly in 
mozilla revisions before 0.9.9 so this is really a regression.

RFCs does not really have anything to say about sending or not the filename 
key, so there should not be any reason to function differently than 
Netscape/Opera/IE/Mozilla pre 0.9.9/whatever.


OK, ebay chokes hard on this so there are in fact major breakages in the real
world.  Duping to bug 133453, which has the necessary approvals to get this fix
in for 1.0.  Sigh.

*** This bug has been marked as a duplicate of 133453 ***
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → DUPLICATE
verifying
Status: RESOLVED → VERIFIED
Component: HTML: Form Submission → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.