Skip to content

Commit 825e69d

Browse files
Merge branch '2' into 3.0
2 parents f4b1c8d + 0ef0b17 commit 825e69d

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

client/dist/js/bundle.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/components/UploadField/UploadField.js

+1
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,7 @@ class UploadField extends Component {
426426
url: this.props.data.endpoints.createFile.url,
427427
method: this.props.data.endpoints.createFile.method,
428428
paramName: 'Upload',
429+
parallelUploads: this.props.data.maxParallelUploads,
429430
maxFiles,
430431
maxFilesize,
431432
thumbnailWidth: CONSTANTS.SMALL_THUMBNAIL_WIDTH,

code/Forms/UploadField.php

+23
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class UploadField extends FormField implements FileHandleField
7474
*/
7575
protected $allowedMaxFileNumber = null;
7676

77+
/**
78+
* Set the max amount of parallel uploads
79+
*/
80+
protected int $maxParallelUploads = 2;
81+
7782
protected $inputType = 'file';
7883

7984
protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_CUSTOM;
@@ -117,6 +122,7 @@ public function getSchemaDataDefaults()
117122

118123
$defaults['data']['maxFilesize'] = $this->getAllowedMaxFileSize() / 1024 / 1024;
119124
$defaults['data']['maxFiles'] = $this->getAllowedMaxFileNumber();
125+
$defaults['data']['maxParallelUploads'] = $this->getMaxParallelUploads();
120126
$defaults['data']['multi'] = $this->getIsMultiUpload();
121127
$defaults['data']['parentid'] = $this->getFolderID();
122128
$defaults['data']['canUpload'] = $this->getUploadEnabled();
@@ -361,6 +367,23 @@ public function setUploadEnabled($uploadEnabled)
361367
return $this;
362368
}
363369

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+
364387
/**
365388
* Check if attaching files is enabled
366389
*

tests/php/Forms/UploadFieldTest.php

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function testSchemaInRenderedField(): void
142142
'parentid' => 0,
143143
'canUpload' => true,
144144
'canAttach' => true,
145+
'maxParallelUploads' => 2
145146
],
146147
];
147148
$state = [

0 commit comments

Comments
 (0)