@@ -20,6 +20,7 @@ export interface AuFileUploadSignature {
20
20
helpTextDragDrop? : string ;
21
21
helpTextFileNotSupported? : string ;
22
22
maxFileSizeMB? : number ;
23
+ minFileSizeKB? : number ;
23
24
multiple? : boolean ;
24
25
onFinishUpload? : (uploadedFile : number , queueInfo : QueueInfo ) => void ;
25
26
onQueueUpdate? : (queueInfo : QueueInfo ) => void ;
@@ -87,6 +88,10 @@ export default class AuFileUpload extends Component<AuFileUploadSignature> {
87
88
return this .args .maxFileSizeMB || 20 ;
88
89
}
89
90
91
+ get minFileSizeKB() {
92
+ return this .args .minFileSizeKB || 0 ;
93
+ }
94
+
90
95
get hasErrors() {
91
96
return this .uploadErrorData .length > 0 ;
92
97
}
@@ -138,7 +143,17 @@ export default class AuFileUpload extends Component<AuFileUploadSignature> {
138
143
}
139
144
}
140
145
141
- if (! isValidFileSize (file .size , this .maxFileSizeMB )) {
146
+ if (file .size === 0 ) {
147
+ this .addError (file , ' Bestand is leeg (0 bytes)' );
148
+ return false ;
149
+ }
150
+
151
+ if (file .size < this .minFileSizeKB * 1024 ) {
152
+ this .addError (file , ` Bestand is te klein (min ${this .minFileSizeKB } KB) ` );
153
+ return false ;
154
+ }
155
+
156
+ if (file .size >= this .maxFileSizeMB * Math .pow (1024 , 2 )) {
142
157
this .addError (file , ` Bestand is te groot (max ${this .maxFileSizeMB } MB) ` );
143
158
return false ;
144
159
}
@@ -301,7 +316,3 @@ function isValidExtension(
301
316
): boolean {
302
317
return validExtensions .includes (extension );
303
318
}
304
-
305
- function isValidFileSize(fileSize : number , maximumSize : number ): boolean {
306
- return fileSize < maximumSize * Math .pow (1024 , 2 );
307
- }
0 commit comments