Try using this code for multi-user download
<form method="post" action="upload-page.php" enctype="multipart/form-data"> <input name="filesToUpload[]" id="filesToUpload" type="file" multiple="" /> </form>
In php
if(count($_FILES['uploads']['filesToUpload'])) { foreach ($_FILES['uploads']['filesToUpload'] as $file) {
To show file name using javascript
//get the input and UL list var input = document.getElementById('filesToUpload'); var list = document.getElementById('fileList'); //empty list for now... while (list.hasChildNodes()) { list.removeChild(ul.firstChild); } //for every file... for (var x = 0; x < input.files.length; x++) { //add to list var li = document.createElement('li'); li.innerHTML = 'File ' + (x + 1) + ': ' + input.files[x].name; list.append(li); }
user2253787
source share