jQuery file upload 업데이트

- IE8에서 동작하지 않을 수 있는 문제 해결
This commit is contained in:
bnu 2015-07-15 17:18:45 +09:00
parent 4492da9bbd
commit ec5a496327
3 changed files with 20 additions and 15 deletions

View file

@ -37,7 +37,7 @@
// send Blob objects via XHR requests: // send Blob objects via XHR requests:
disableImageResize: /Android(?!.*Chrome)|Opera/ disableImageResize: /Android(?!.*Chrome)|Opera/
.test(window.navigator.userAgent), .test(window.navigator.userAgent),
maxFileSize: 5000000, maxFileSize: 999000,
acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
}); });
} }

View file

@ -242,7 +242,7 @@
blob.name = file.name; blob.name = file.name;
} else if (file.name) { } else if (file.name) {
blob.name = file.name.replace( blob.name = file.name.replace(
/\..+$/, /\.\w+$/,
'.' + blob.type.substr(6) '.' + blob.type.substr(6)
); );
} }

View file

@ -1,5 +1,5 @@
/* /*
* jQuery File Upload Plugin 5.42.2 * jQuery File Upload Plugin 5.42.3
* https://github.com/blueimp/jQuery-File-Upload * https://github.com/blueimp/jQuery-File-Upload
* *
* Copyright 2010, Sebastian Tschan * Copyright 2010, Sebastian Tschan
@ -277,7 +277,8 @@
// The following are jQuery ajax settings required for the file uploads: // The following are jQuery ajax settings required for the file uploads:
processData: false, processData: false,
contentType: false, contentType: false,
cache: false cache: false,
timeout: 0
}, },
// A list of options that require reinitializing event listeners and/or // A list of options that require reinitializing event listeners and/or
@ -983,7 +984,10 @@
fileSet, fileSet,
i, i,
j = 0; j = 0;
if (limitSize && (!filesLength || files[0].size === undefined)) { if (!filesLength) {
return false;
}
if (limitSize && files[0].size === undefined) {
limitSize = undefined; limitSize = undefined;
} }
if (!(options.singleFileUploads || limit || limitSize) || if (!(options.singleFileUploads || limit || limitSize) ||
@ -1344,18 +1348,19 @@
_initDataAttributes: function () { _initDataAttributes: function () {
var that = this, var that = this,
options = this.options, options = this.options,
clone = $(this.element[0].cloneNode(false)), data = this.element.data();
data = clone.data();
// Avoid memory leaks:
clone.remove();
// Initialize options set via HTML5 data-attributes: // Initialize options set via HTML5 data-attributes:
$.each( $.each(
data, this.element[0].attributes,
function (key, value) { function (index, attr) {
var dataAttributeName = 'data-' + var key = attr.name.toLowerCase(),
// Convert camelCase to hyphen-ated key: value;
key.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); if (/^data-/.test(key)) {
if (clone.attr(dataAttributeName)) { // Convert hyphen-ated key to camelCase:
key = key.slice(5).replace(/-[a-z]/g, function (str) {
return str.charAt(1).toUpperCase();
});
value = data[key];
if (that._isRegExpOption(key, value)) { if (that._isRegExpOption(key, value)) {
value = that._getRegExp(value); value = that._getRegExp(value);
} }