There is a download page for files with this code:
echo '<form action="upload.php" method="post" enctype="multipart/form-data"> Файлы:<br /><div id="upload"> <input name=userfile[] type=file><br> <input name=userfile[] type=file><br> <input name=userfile[] type=file><br> <input name=userfile[] type=file><br> <input name=userfile[] type=file><br> </div><br> <input type="submit" value="Отправить" /> </form> <div id="continue">Добавить еще</div><br>'; echo '</div> <script> var i = 0; $("#continue").click(function(e){e.preventDefault(); console.log(i); if(i<=14){ var txt = "<input name=userfile[] type=file><br>"; i++; $("#upload").append(txt); } if(i == 15){ $("#continue").remove(); } }) </script>'; and there is a handler:
$path = 'upload/'; for($i=0; $i<count($_FILES['userfile']); $i++){ if(!empty($_FILES['userfile']['name'][$i])){ echo $_FILES['userfile']['name'][$i].' \ '.$i.'<br>'; copy($_FILES['userfile']['tmp_name'][$i], $path . $_FILES['userfile']['name'][$i]); } } The problem is that the handler does not see the load forms added by JS. I ask for help)