Skip to content
This repository was archived by the owner on May 25, 2023. It is now read-only.

Commit d64d95a

Browse files
committed
Fixes an issue with jQuery form serialization beginning to include file inputs in jQuery 1.9. Also fixes S3 uploading.
1 parent f60bbfb commit d64d95a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

js/jquery.fileupload.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@
3333
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
3434
$.support.xhrFormDataFileUpload = !!window.FormData;
3535

36+
// The form.elements propHook is added to filter serialized elements
37+
// to not include file inputs in jQuery 1.9.0
38+
// This hooks directly into jQuery.fn.serializeArray
39+
// For more info, see http://bugs.jquery.com/ticket/13306
40+
$.propHooks.elements = {
41+
get: function(form) {
42+
if (jQuery.nodeName(form, "form")) {
43+
return jQuery.grep(form.elements, function(elem) {
44+
return !jQuery.nodeName(elem, "input") || elem.type !== "file";
45+
});
46+
}
47+
return null;
48+
}
49+
};
50+
3651
// The fileupload widget listens for change events on file input fields defined
3752
// via fileInput setting and paste or drop events of the given dropZone.
3853
// In addition to the default jQuery Widget methods, the fileupload widget

0 commit comments

Comments
 (0)