app/assets/javascripts/jquery.fileupload.js in uploadbox-0.0.7 vs app/assets/javascripts/jquery.fileupload.js in uploadbox-0.0.8
- old
+ new
@@ -1,7 +1,7 @@
/*
- * jQuery File Upload Plugin 5.31.6
+ * jQuery File Upload Plugin 5.32.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
* https://blueimp.net
*
@@ -25,10 +25,22 @@
factory(window.jQuery);
}
}(function ($) {
'use strict';
+ // Detect file input support, based on
+ // http://viljamis.com/blog/2012/file-upload-support-on-mobile/
+ $.support.fileInput = !(new RegExp(
+ // Handle devices which give false positives for the feature detection:
+ '(Android (1\\.[0156]|2\\.[01]))' +
+ '|(Windows Phone (OS 7|8\\.0))|(XBLWP)|(ZuneWP)|(WPDesktop)' +
+ '|(w(eb)?OSBrowser)|(webOS)' +
+ '|(Kindle/(1\\.0|2\\.[05]|3\\.0))'
+ ).test(window.navigator.userAgent) ||
+ // Feature detection for all other devices:
+ $('<input type="file">').prop('disabled'));
+
// The FileReader API is not actually used, but works as feature detection,
// as e.g. Safari supports XHR file uploads via the FormData API,
// but not non-multipart XHR file uploads:
$.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);
$.support.xhrFormDataFileUpload = !!window.FormData;
@@ -385,11 +397,11 @@
formData,
file = options.files[0],
// Ignore non-multipart setting if not supported:
multipart = options.multipart || !$.support.xhrFileUpload,
paramName = options.paramName[0];
- options.headers = options.headers || {};
+ options.headers = $.extend({}, options.headers);
if (options.contentRange) {
options.headers['Content-Range'] = options.contentRange;
}
if (!multipart || options.blob || !this._isInstanceOf('File', file)) {
options.headers['Content-Disposition'] = 'attachment; filename="' +
@@ -1151,13 +1163,15 @@
});
this._on(this.options.pasteZone, {
paste: this._onPaste
});
}
- this._on(this.options.fileInput, {
- change: this._onChange
- });
+ if ($.support.fileInput) {
+ this._on(this.options.fileInput, {
+ change: this._onChange
+ });
+ }
},
_destroyEventHandlers: function () {
this._off(this.options.dropZone, 'dragover drop');
this._off(this.options.pasteZone, 'paste');
@@ -1285,9 +1299,13 @@
return promise;
};
this._getFileInputFiles(data.fileInput).always(
function (files) {
if (aborted) {
+ return;
+ }
+ if (!files.length) {
+ dfd.reject();
return;
}
data.files = files;
jqXHR = that._onSend(null, data).then(
function (result, textStatus, jqXHR) {