Limit the number of files that can be uploaded at the same time
This commit is contained in:
parent
485954ee5e
commit
4eee4e51fc
1 changed files with 11 additions and 0 deletions
|
@ -35,6 +35,11 @@ class Files
|
|||
*/
|
||||
protected int $maxPixels;
|
||||
|
||||
/**
|
||||
* Максимальное число одновременно загружаемых файлов
|
||||
*/
|
||||
protected int $maxMultiple = 10;
|
||||
|
||||
/**
|
||||
* Текст ошибки
|
||||
*/
|
||||
|
@ -1037,6 +1042,12 @@ class Files
|
|||
}
|
||||
|
||||
if (\is_array($file['tmp_name'])) {
|
||||
if (\count($file['tmp_name']) > $this->maxMultiple) {
|
||||
$this->error = 'Lots of files to upload';
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
$result = [];
|
||||
|
||||
foreach ($file['tmp_name'] as $key => $tmpName) {
|
||||
|
|
Loading…
Add table
Reference in a new issue