Selaa lähdekoodia

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

Visman 2 vuotta sitten
vanhempi
commit
4eee4e51fc
1 muutettua tiedostoa jossa 11 lisäystä ja 0 poistoa
  1. 11 0
      app/Core/Files.php

+ 11 - 0
app/Core/Files.php

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