Limit the number of files that can be uploaded at the same time

This commit is contained in:
Visman 2023-07-08 23:05:36 +07:00
parent 485954ee5e
commit 4eee4e51fc

View file

@ -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) {