Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NEW Allow changing parallelUploads config in UploadField #1539

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
NEW Allow changing parallelUploads config in UploadField
NEW Allow changing parallelUploads config in UploadField

NEW Allow changing parallelUploads config in UploadField

NEW Allow changing parallelUploads config in UploadField
Mikal de Langen committed Feb 11, 2025
commit 4182164494a04bc1a5c3feee595505996f9ef24b
2 changes: 1 addition & 1 deletion client/dist/js/bundle.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/src/components/UploadField/UploadField.js
Original file line number Diff line number Diff line change
@@ -426,6 +426,7 @@ class UploadField extends Component {
url: this.props.data.createFileEndpoint.url,
method: this.props.data.createFileEndpoint.method,
paramName: 'Upload',
parallelUploads: this.props.data.maxParallelUploads,
maxFiles,
maxFilesize,
thumbnailWidth: CONSTANTS.SMALL_THUMBNAIL_WIDTH,
23 changes: 23 additions & 0 deletions code/Forms/UploadField.php
Original file line number Diff line number Diff line change
@@ -73,6 +73,11 @@ class UploadField extends FormField implements FileHandleField
*/
protected $allowedMaxFileNumber = null;

/**
* Set the max amount of parallel uploads
*/
protected int $maxParallelUploads = 2;

protected $inputType = 'file';

protected $schemaDataType = FormField::SCHEMA_DATA_TYPE_CUSTOM;
@@ -116,6 +121,7 @@ public function getSchemaDataDefaults()

$defaults['data']['maxFilesize'] = $this->getAllowedMaxFileSize() / 1024 / 1024;
$defaults['data']['maxFiles'] = $this->getAllowedMaxFileNumber();
$defaults['data']['maxParallelUploads'] = $this->getMaxParallelUploads();
$defaults['data']['multi'] = $this->getIsMultiUpload();
$defaults['data']['parentid'] = $this->getFolderID();
$defaults['data']['canUpload'] = $this->getUploadEnabled();
@@ -366,6 +372,23 @@ public function setUploadEnabled($uploadEnabled)
return $this;
}

/**
* Get the amount of max parallel uploads
*/
public function getMaxParallelUploads(): int
{
return $this->maxParallelUploads;
}

/**
* Set amount of max parallel uploads
*/
public function setMaxParallelUploads(int $maxParallelUploads): static
{
$this->maxParallelUploads = $maxParallelUploads;
return $this;
}

/**
* Check if attaching files is enabled
*
1 change: 1 addition & 0 deletions tests/php/Forms/UploadFieldTest.php
Original file line number Diff line number Diff line change
@@ -119,6 +119,7 @@ public function testGetAttributes()
'maxFiles' => null,
'canUpload' => true,
'canAttach' => true,
'maxParallelUploads' => 2
],
'schemaType' => 'Custom'
];