Side navigation
#3290 closed bug (invalid)
Opened August 25, 2008 10:06PM UTC
Closed October 12, 2009 11:18PM UTC
Last modified March 14, 2012 09:18PM UTC
File Upload field results in jQuery doing a form submit, dropping page element in POST
Reported by: | taylors | Owned by: | malsup |
---|---|---|---|
Priority: | major | Milestone: | 1.3 |
Component: | plugin | Version: | 1.2.3 |
Keywords: | form upload fi | Cc: | malsup, taylors |
Blocked by: | Blocking: |
Description
When submitting a form (via submit element) containing a file upload, the page element is left out of the POST request.
In jquery.form.js (v2.07), it is stated:
@desc Submit form and update page element with server response
This is violated if files are present (or options.iframe - line 244) and the fileUpload() function is called. This results in a form.submit() action on line 318, rather than submitting the page element and other options present. Please contact me for further clarification.
Attachments (0)
Change History (5)
Changed August 26, 2008 06:14PM UTC by comment:1
cc: | → malsup, taylors |
---|---|
component: | core → plugin |
keywords: | → form upload fi |
owner: | → malsup |
Changed August 26, 2008 07:48PM UTC by comment:2
the page element is left out of the POST request
I don't understand what you mean by this. Can you please explain or post an example?
Changed August 27, 2008 04:26PM UTC by comment:3
Suppose you have a form like this
<form action="..." method="post" enctype="multipart/form-data">
<input type="hidden" name="extra_data" value="42" />
<input type="file" name="the_file" />
<input type="submit" name="UPLOAD" value="Upload file" />
</form>
and you make it AJAX-y by calling jQuery's ajaxForm().
Now if you press the UPLOAD button without selecting a file, the web server will see extra_data=42&the_file=&UPLOAD=Upload+file, which is correct.
If you select a file and then press UPLOAD, the web server will see extra_data and the the_file fields, but UPLOAD field will be missing from the request.
This is bad if you have multiple submit buttons and want to determine which one was pressed. It is also contrary to jQuery's documentation that taylors quoted.
.
Changed November 02, 2008 11:33PM UTC by comment:4
This was fixed in version 2.12.
Changed October 12, 2009 11:18PM UTC by comment:5
resolution: | → invalid |
---|---|
status: | new → closed |
This is not a jQuery core bug. Please report plugin bugs to the plugin's author, or ask on the jQuery forums. jQuery UI bugs should be reported on the UI bug tracker, http://dev.jqueryui.com .