Update jQuery File Upload to version 9.5.7

pull/30/head
Francis Lachapelle 2014-03-21 13:47:40 -04:00
parent 877e44c6d2
commit 93f1540c17
3 changed files with 32 additions and 18 deletions

1
NEWS
View File

@ -5,6 +5,7 @@ Enhancements
- updated French translation
- added sanitization support for Outlook/ActiveSync to circumvent Outlook bugs (#2667)
- updated CKEditor to version 4.3.3
- updated jQuery File Upload to version 9.5.7
Bug fixes
- fixed possible exception when retrieving the default event reminder value on 64bit architectures (#2647, #2648)

View File

@ -1,5 +1,5 @@
/*
* jQuery File Upload Plugin 5.39.0
* jQuery File Upload Plugin 5.40.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
@ -9,8 +9,8 @@
* http://www.opensource.org/licenses/MIT
*/
/*jslint nomen: true, unparam: true, regexp: true */
/*global define, window, document, location, File, Blob, FormData */
/* jshint nomen:false */
/* global define, window, document, location, Blob, FormData */
(function (factory) {
'use strict';
@ -419,7 +419,8 @@
file = options.files[0],
// Ignore non-multipart setting if not supported:
multipart = options.multipart || !$.support.xhrFileUpload,
paramName = options.paramName[0];
paramName = $.type(options.paramName) === 'array' ?
options.paramName[0] : options.paramName;
options.headers = $.extend({}, options.headers);
if (options.contentRange) {
options.headers['Content-Range'] = options.contentRange;
@ -429,7 +430,7 @@
encodeURI(file.name) + '"';
}
if (!multipart) {
options.contentType = file.type;
options.contentType = file.type || 'application/octet-stream';
options.data = options.blob || file;
} else if ($.support.xhrFormDataFileUpload) {
if (options.postMessage) {
@ -446,7 +447,8 @@
} else {
$.each(options.files, function (index, file) {
formData.push({
name: options.paramName[index] || paramName,
name: ($.type(options.paramName) === 'array' &&
options.paramName[index]) || paramName,
value: file
});
});
@ -469,7 +471,8 @@
if (that._isInstanceOf('File', file) ||
that._isInstanceOf('Blob', file)) {
formData.append(
options.paramName[index] || paramName,
($.type(options.paramName) === 'array' &&
options.paramName[index]) || paramName,
file,
file.uploadName || file.name
);
@ -979,8 +982,8 @@
for (i = 0; i < filesLength; i = i + 1) {
batchSize += files[i].size + overhead;
if (i + 1 === filesLength ||
(batchSize + files[i + 1].size + overhead) >
limitSize) {
((batchSize + files[i + 1].size + overhead) > limitSize) ||
(limit && i + 1 - j >= limit)) {
fileSet.push(files.slice(j, i + 1));
paramNameSlice = paramName.slice(j, i + 1);
if (!paramNameSlice.length) {
@ -1304,15 +1307,21 @@
_initDataAttributes: function () {
var that = this,
options = this.options;
options = this.options,
clone = $(this.element[0].cloneNode(false));
// Initialize options set via HTML5 data-attributes:
$.each(
$(this.element[0].cloneNode(false)).data(),
clone.data(),
function (key, value) {
if (that._isRegExpOption(key, value)) {
value = that._getRegExp(value);
var dataAttributeName = 'data-' +
// Convert camelCase to hyphen-ated key:
key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
if (clone.attr(dataAttributeName)) {
if (that._isRegExpOption(key, value)) {
value = that._getRegExp(value);
}
options[key] = value;
}
options[key] = value;
}
);
},

View File

@ -1,5 +1,5 @@
/*
* jQuery Iframe Transport Plugin 1.8.1
* jQuery Iframe Transport Plugin 1.8.2
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2011, Sebastian Tschan
@ -9,8 +9,7 @@
* http://www.opensource.org/licenses/MIT
*/
/*jslint unparam: true, nomen: true */
/*global define, window, document */
/* global define, window, document */
(function (factory) {
'use strict';
@ -143,6 +142,8 @@
.prop('enctype', 'multipart/form-data')
// enctype must be set as encoding for IE:
.prop('encoding', 'multipart/form-data');
// Remove the HTML5 form attribute from the input(s):
options.fileInput.removeAttr('form');
}
form.submit();
// Insert the file input fields at their original location
@ -150,7 +151,10 @@
if (fileInputClones && fileInputClones.length) {
options.fileInput.each(function (index, input) {
var clone = $(fileInputClones[index]);
$(input).prop('name', clone.prop('name'));
// Restore the original name and form properties:
$(input)
.prop('name', clone.prop('name'))
.attr('form', clone.attr('form'));
clone.replaceWith(input);
});
}