Skip to content

Commit bbe8ee0

Browse files
committed
Update jquery.form.js
With the jQuery versions higher than 1.8.3 (1.10.2 in our site), I was encountering an issue where an Ajax file upload was not being sent as multi-part. I found this issue was due to the value attribute selector not getting the correct value for the file input element, so [value!=''] was always false. I changed it to use the filter function instead and used val() to check the actual value. This works better at checking the value.
1 parent be5f58e commit bbe8ee0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jquery.form.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ $.fn.ajaxSubmit = function(options) {
209209

210210
// [value] (issue #113), also see comment:
211211
// https://github.com/malsup/form/commit/588306aedba1de01388032d5f42a60159eea9228#commitcomment-2180219
212-
var fileInputs = $('input[type=file]:enabled:not([value=""])', this);
212+
var fileInputs = $('input[type=file]:enabled', this).filter(function() { return $(this).val() != ''; });
213213

214214
var hasFileInputs = fileInputs.length > 0;
215215
var mp = 'multipart/form-data';

0 commit comments

Comments
 (0)