Ошибка загрузки нескольких изображений при загрузке более 20 изображений или около того

У меня проблема с несколькими загрузками в нескольких полях. У меня есть 3 поля для загрузки файлов. Когда я загружаю по десять в каждом. Я не получаю некоторые файлы.

<input type="file" name="before[]" multiple>
<input type="file" name="during[]" multiple>
<input type="file" name="after[]" multiple>

когда я печатаю_r ($ _ FILES); Я получаю как следующий вывод

Array
(
[before] => Array
(
[name] => Array
(
[0] => loose_diamond.jpg
[1] => silver.jpg
[2] => loose_diamond.jpg
[3] => silver_ware.jpg
[4] => diamond.jpg
[5] => loose_diamond.jpg
[6] => diamond.jpg
[7] => loose_diamond.jpg
[8] => diamond.jpg
[9] => loose_diamond.jpg
)

[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
[2] => image/jpeg
[3] => image/jpeg
[4] => image/jpeg
[5] => image/jpeg
[6] => image/jpeg
[7] => image/jpeg
[8] => image/jpeg
[9] => image/jpeg
)

[tmp_name] => Array
(
[0] => /tmp/phpr1CABT
[1] => /tmp/phpEhK0Wk
[2] => /tmp/phpVq54jM
[3] => /tmp/phpan3pId
[4] => /tmp/phplXVb0G
[5] => /tmp/phpWWfyja
[6] => /tmp/php5zLcZD
[7] => /tmp/phpWZu4F7
[8] => /tmp/phpHk8VzB
[9] => /tmp/php4OQPI5
)

[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
[8] => 0
[9] => 0
)

[size] => Array
(
[0] => 6450
[1] => 6851
[2] => 6450
[3] => 7866
[4] => 6372
[5] => 6450
[6] => 6372
[7] => 6450
[8] => 6372
[9] => 6450
)

)

[during] => Array
(
[name] => Array
(
[0] => loose_diamond.jpg
[1] => silver.jpg
[2] => silver.jpg
[3] => silver_ware.jpg
[4] => silver_ware.jpg
[5] => watch.jpg
[6] => machinery.jpg
[7] => conis.jpg
[8] => silver_ware.jpg
[9] => machinery.jpg
)

[type] => Array
(
[0] => image/jpeg
[1] => image/jpeg
[2] => image/jpeg
[3] => image/jpeg
[4] => image/jpeg
[5] => image/jpeg
[6] => image/jpeg
[7] => image/jpeg
[8] => image/jpeg
[9] => image/jpeg
)

[tmp_name] => Array
(
[0] => /tmp/php3eBKVz
[1] => /tmp/phpk0GxK4
[2] => /tmp/phplPxWDz
[3] => /tmp/php2J8Ry4
[4] => /tmp/php5b8pwA
[5] => /tmp/phpU1UvZ6
[6] => /tmp/phpHP7zAD
[7] => /tmp/phpKpfZwa
[8] => /tmp/phpl9SHvH
[9] => /tmp/php693Gbf
)

[error] => Array
(
[0] => 0
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
[8] => 0
[9] => 0
)

[size] => Array
(
[0] => 6450
[1] => 6851
[2] => 6851
[3] => 7866
[4] => 7866
[5] => 8119
[6] => 8173
[7] => 8789
[8] => 7866
[9] => 8173
)

)

[images[]] => Array
(
[name] => machinery.jpg
[type] => image/jpeg
[tmp_name] => /tmp/php693Gbf
[error] => 0
[size] => 8173
)

)

Замечания: когда я загружаю 5 изображений, каждое работает нормально.

0

Решение

Вам необходимо установить значение upload_max_filesize а также post_max_size в вашем php.ini:

; Maximum allowed size for uploaded files.
upload_max_filesize = 2048M //or as per your requirements

; Must be greater than or equal to upload_max_filesize
post_max_size = 2048M  //or as per your requirements

После изменения файла (ов) php.ini вам необходимо перезапустить сервер HTTP, чтобы использовать новую конфигурацию.

Прочитай это : http://php.net/manual/en/ini.core.php

2

Другие решения

В вашем php.ini, проверьте это

    ; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
2

  • Время ожидания контроля
  • контроль max_file_uploads в php.ini
  • контроль post_max_size в php.ini
  • контроль upload_max_filesize в php.ini
0
По вопросам рекламы [email protected]