File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
Backend/view/adminhtml/web/js
Ui/view/base/web/js/form/element Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,16 @@ define([
74
74
$ . mage . __ ( 'We could not detect a size.' ) :
75
75
byteConvert ( currentFile . size ) ;
76
76
77
+ // check if file is allowed to upload and resize
78
+ allowedResize = $ . inArray ( currentFile . extension , allowedExt ) !== - 1 ;
79
+
80
+ if ( ! allowedResize ) {
81
+ fileUploader . aggregateError ( currentFile . name ,
82
+ $ . mage . __ ( 'Disallowed file type.' ) ) ;
83
+ fileUploader . onLoadingStop ( ) ;
84
+ return false ;
85
+ }
86
+
77
87
fileId = Math . random ( ) . toString ( 33 ) . substr ( 2 , 18 ) ;
78
88
79
89
tmpl = progressTmpl ( {
@@ -91,9 +101,6 @@ define([
91
101
tempFileId : fileId
92
102
} ;
93
103
94
- // check if resize allowed for file extension
95
- allowedResize = $ . inArray ( currentFile . extension , allowedExt ) !== - 1 ;
96
-
97
104
$ ( tmpl ) . appendTo ( self . element ) ;
98
105
return modifiedFile ;
99
106
} ,
Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ define([
68
68
if ( fileInput !== undefined ) {
69
69
let targetElement = $ ( fileInput ) . closest ( '.file-uploader-area' ) [ 0 ] ,
70
70
dropTargetElement = $ ( fileInput ) . closest ( this . dropZone ) [ 0 ] ,
71
- fileObj = [ ] ,
72
71
formKey = window . FORM_KEY !== undefined ? window . FORM_KEY : $ . cookie ( 'form_key' ) ,
73
72
fileInputName = this . fileInputName ,
74
73
arrayFromObj = Array . from ,
@@ -105,12 +104,8 @@ define([
105
104
}
106
105
107
106
if ( ! allowed . passed ) {
108
- fileObj . push ( currentFile ) ;
109
107
this . aggregateError ( file . name , allowed . message ) ;
110
-
111
- if ( this . aggregatedErrors . length === fileObj . length ) {
112
- this . uploaderConfig . stop ( ) ;
113
- }
108
+ this . uploaderConfig . stop ( ) ;
114
109
return false ;
115
110
}
116
111
You can’t perform that action at this time.
0 commit comments