Skip to content

Commit 04eb2a6

Browse files
authored
Merge pull request Vanthink-UED#238 from geekgray/master
fix: multiple files file size validation
2 parents 0afe1ec + 5fcbc12 commit 04eb2a6

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/vue-core-image-upload.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@
9393
return this.__dispatch('errorhandle','TYPE ERROR');
9494
}
9595
}
96-
if (e.target.files[0].size > this.maxFileSize) {
96+
97+
if (Array.prototype.slice.call(e.target.files).some(file => file.size > this.maxFileSize)) {
9798
var formatSize;
9899
if (parseInt(this.maxFileSize / 1024 / 1024) > 0) {
99100
formatSize = (this.maxFileSize / 1024 / 1024).toFixed(2) + 'MB';
@@ -109,7 +110,7 @@
109110
if (this.multipleSize > 0 && e.target.files.length > this.multipleSize) {
110111
console.warn('FILE NUM IS LARGER THAN ' + this.multipleSize);
111112
return this.__dispatch('errorhandle', 'FILE NUM OVERLOAD');
112-
}
113+
}
113114
114115
this.files = e.target.files;
115116
if (this.crop || this.resize) {

0 commit comments

Comments
 (0)