There is such a code:
<?php foreach ($_POST as $index => $value) { $$index = $value; } $uploaddir = './files/'; for ($i=0; $i<=count($_FILES); $i++) { $uploadFile = $uploadDir.basename($_FILES['userFile']['name'][$i]); if (copy($_FILES['userFile']['tmp_name'][$i], $uploadFile)) { echo "<h3>Файл успешно загружен на сервер</h3>"; } else { echo "<h3>Ошибка! Не удалось загрузить файл на сервер!</h3>";} } ?> <form action="mce.php" method="post" enctype="multipart/form-data"> <input name="userFile[]" type="file" multiple><br> <input type="submit" value="Загрузить"> </form> In theory, it should load many files, but does not load more than two files. I understand that there is some kind of mistake in the cycle, but I can’t figure out how to fix it. What's wrong?
$_POST? - Raz Galstyan