File tree 4 files changed +26
-1
lines changed
src/components/UploadField
4 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,7 @@ class UploadField extends Component {
426
426
url : this . props . data . endpoints . createFile . url ,
427
427
method : this . props . data . endpoints . createFile . method ,
428
428
paramName : 'Upload' ,
429
+ parallelUploads : this . props . data . maxParallelUploads ,
429
430
maxFiles,
430
431
maxFilesize,
431
432
thumbnailWidth : CONSTANTS . SMALL_THUMBNAIL_WIDTH ,
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ class UploadField extends FormField implements FileHandleField
74
74
*/
75
75
protected $ allowedMaxFileNumber = null ;
76
76
77
+ /**
78
+ * Set the max amount of parallel uploads
79
+ */
80
+ protected int $ maxParallelUploads = 2 ;
81
+
77
82
protected $ inputType = 'file ' ;
78
83
79
84
protected $ schemaDataType = FormField::SCHEMA_DATA_TYPE_CUSTOM ;
@@ -117,6 +122,7 @@ public function getSchemaDataDefaults()
117
122
118
123
$ defaults ['data ' ]['maxFilesize ' ] = $ this ->getAllowedMaxFileSize () / 1024 / 1024 ;
119
124
$ defaults ['data ' ]['maxFiles ' ] = $ this ->getAllowedMaxFileNumber ();
125
+ $ defaults ['data ' ]['maxParallelUploads ' ] = $ this ->getMaxParallelUploads ();
120
126
$ defaults ['data ' ]['multi ' ] = $ this ->getIsMultiUpload ();
121
127
$ defaults ['data ' ]['parentid ' ] = $ this ->getFolderID ();
122
128
$ defaults ['data ' ]['canUpload ' ] = $ this ->getUploadEnabled ();
@@ -361,6 +367,23 @@ public function setUploadEnabled($uploadEnabled)
361
367
return $ this ;
362
368
}
363
369
370
+ /**
371
+ * Get the amount of max parallel uploads
372
+ */
373
+ public function getMaxParallelUploads (): int
374
+ {
375
+ return $ this ->maxParallelUploads ;
376
+ }
377
+
378
+ /**
379
+ * Set amount of max parallel uploads
380
+ */
381
+ public function setMaxParallelUploads (int $ maxParallelUploads ): static
382
+ {
383
+ $ this ->maxParallelUploads = $ maxParallelUploads ;
384
+ return $ this ;
385
+ }
386
+
364
387
/**
365
388
* Check if attaching files is enabled
366
389
*
Original file line number Diff line number Diff line change @@ -142,6 +142,7 @@ public function testSchemaInRenderedField(): void
142
142
'parentid ' => 0 ,
143
143
'canUpload ' => true ,
144
144
'canAttach ' => true ,
145
+ 'maxParallelUploads ' => 2
145
146
],
146
147
];
147
148
$ state = [
You can’t perform that action at this time.
0 commit comments