|
@@ -1,5 +1,5 @@
|
|
|
/*!
|
|
|
- * bootstrap-fileinput v4.3.5
|
|
|
+ * bootstrap-fileinput v4.3.6
|
|
|
* http://plugins.krajee.com/file-input
|
|
|
*
|
|
|
* Author: Kartik Visweswaran
|
|
@@ -460,7 +460,7 @@
|
|
|
other: {width: "160px", height: "160px"}
|
|
|
};
|
|
|
defaultPreviewZoomSettings = {
|
|
|
- image: {width: "100%", height: "100%"},
|
|
|
+ image: {width: "auto", height: "auto", 'max-width': "100%",'max-height': "100%"},
|
|
|
html: {width: "100%", height: "100%", 'min-height': "480px"},
|
|
|
text: {width: "100%", height: "100%", 'min-height': "480px"},
|
|
|
video: {width: "auto", height: "100%", 'max-width': "100%"},
|
|
@@ -2167,10 +2167,10 @@
|
|
|
self._previewDefault(file, previewId, true);
|
|
|
if (self.isUploadable) {
|
|
|
self.addToStack(undefined);
|
|
|
+ setTimeout(function () {
|
|
|
+ readFile(index + 1);
|
|
|
+ }, 100);
|
|
|
}
|
|
|
- setTimeout(function () {
|
|
|
- readFile(index + 1);
|
|
|
- }, 100);
|
|
|
self._initFileActions();
|
|
|
if (self.removeFromPreviewOnError) {
|
|
|
$('#' + previewId).remove();
|
|
@@ -2201,22 +2201,37 @@
|
|
|
$status.html('');
|
|
|
return;
|
|
|
}
|
|
|
- var node = ctr + i, previewId = previewInitId + "-" + node, isText, isImage, file = files[i],
|
|
|
+ var node = ctr + i, previewId = previewInitId + "-" + node, isText, isImage, file = files[i], fSizeKB,
|
|
|
caption = file.name ? self.slug(file.name) : '', fileSize = (file.size || 0) / 1000, checkFile,
|
|
|
fileExtExpr = '', previewData = objUrl.createObjectURL(file), fileCount = 0, j, msg, typ, chk,
|
|
|
fileTypes = self.allowedFileTypes, strTypes = isEmpty(fileTypes) ? '' : fileTypes.join(', '),
|
|
|
fileExt = self.allowedFileExtensions, strExt = isEmpty(fileExt) ? '' : fileExt.join(', ');
|
|
|
+
|
|
|
+ if (caption === false) {
|
|
|
+ readFile(i + 1);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (caption.length === 0) {
|
|
|
+ msg = self.msgInvalidFileName.replace('{name}', htmlEncode(file.name));
|
|
|
+ self.isError = throwError(msg, file, previewId, i);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!isEmpty(fileExt)) {
|
|
|
fileExtExpr = new RegExp('\\.(' + fileExt.join('|') + ')$', 'i');
|
|
|
}
|
|
|
- fileSize = fileSize.toFixed(2);
|
|
|
+ fSizeKB = fileSize.toFixed(2);
|
|
|
if (self.maxFileSize > 0 && fileSize > self.maxFileSize) {
|
|
|
- msg = self.msgSizeTooLarge.replace('{name}', caption)
|
|
|
- .replace('{size}', fileSize)
|
|
|
+ msg = self.msgSizeTooLarge.replace('{name}', caption).replace('{size}', fSizeKB)
|
|
|
.replace('{maxSize}', self.maxFileSize);
|
|
|
self.isError = throwError(msg, file, previewId, i);
|
|
|
return;
|
|
|
}
|
|
|
+ if (self.minFileSize !== null && fileSize <= getNum(self.minFileSize)) {
|
|
|
+ msg = self.msgSizeTooSmall.replace('{name}', caption).replace('{size}', fSizeKB)
|
|
|
+ .replace('{minSize}', self.minFileSize);
|
|
|
+ self.isError = throwError(msg, file, previewId, i);
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (!isEmpty(fileTypes) && isArray(fileTypes)) {
|
|
|
for (j = 0; j < fileTypes.length; j += 1) {
|
|
|
typ = fileTypes[j];
|
|
@@ -2234,8 +2249,7 @@
|
|
|
chk = compare(caption, fileExtExpr);
|
|
|
fileCount += isEmpty(chk) ? 0 : chk.length;
|
|
|
if (fileCount === 0) {
|
|
|
- msg = self.msgInvalidFileExtension.replace('{name}', caption).replace('{extensions}',
|
|
|
- strExt);
|
|
|
+ msg = self.msgInvalidFileExtension.replace('{name}', caption).replace('{extensions}', strExt);
|
|
|
self.isError = throwError(msg, file, previewId, i);
|
|
|
return;
|
|
|
}
|
|
@@ -2546,7 +2560,7 @@
|
|
|
self._raise('fileimageresized', [pid, ind]);
|
|
|
counter.val++;
|
|
|
if (counter.val === num_imgs) {
|
|
|
- self._raise('fileimagesresized');
|
|
|
+ self._raise('fileimagesresized', [undefined, undefined]);
|
|
|
}
|
|
|
}, type, self.resizeQuality);
|
|
|
return true;
|
|
@@ -2554,7 +2568,7 @@
|
|
|
catch (err) {
|
|
|
counter.val++;
|
|
|
if (counter.val === num_imgs) {
|
|
|
- self._raise('fileimagesresized');
|
|
|
+ self._raise('fileimagesresized', [undefined, undefined]);
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -3224,6 +3238,7 @@
|
|
|
resizePreference: 'width',
|
|
|
resizeQuality: 0.92,
|
|
|
resizeDefaultImageType: 'image/jpeg',
|
|
|
+ minFileSize: 0,
|
|
|
maxFileSize: 0,
|
|
|
maxFilePreviewSize: 25600, // 25 MB
|
|
|
minFileCount: 0,
|
|
@@ -3270,6 +3285,7 @@
|
|
|
msgNoFilesSelected: 'No files selected',
|
|
|
msgCancelled: 'Cancelled',
|
|
|
msgZoomModalHeading: 'Detailed Preview',
|
|
|
+ msgSizeTooSmall: 'File "{name}" (<b>{size} KB</b>) is too small and must be larger than <b>{minSize} KB</b>.',
|
|
|
msgSizeTooLarge: 'File "{name}" (<b>{size} KB</b>) exceeds maximum allowed upload size of <b>{maxSize} KB</b>.',
|
|
|
msgFilesTooLess: 'You must select at least <b>{n}</b> {files} to upload.',
|
|
|
msgFilesTooMany: 'Number of files selected for upload <b>({n})</b> exceeds maximum allowed limit of <b>{m}</b>.',
|
|
@@ -3278,6 +3294,7 @@
|
|
|
msgFileNotReadable: 'File "{name}" is not readable.',
|
|
|
msgFilePreviewAborted: 'File preview aborted for "{name}".',
|
|
|
msgFilePreviewError: 'An error occurred while reading the file "{name}".',
|
|
|
+ msgInvalidFileName: 'Invalid or unsupported characters in file name "{name}".',
|
|
|
msgInvalidFileType: 'Invalid type for file "{name}". Only "{types}" files are supported.',
|
|
|
msgInvalidFileExtension: 'Invalid extension for file "{name}". Only "{extensions}" files are supported.',
|
|
|
msgUploadAborted: 'The file upload was aborted',
|