Multiple File Input in HTML

/ Published in: HTML
Save to your folder(s)

File inputs can have an attribute of "multiple" which then allows multiple files to be selected in the file section dialog box. Currently only Firefox 3.6+ and WebKit browsers are supporting it.

Copy this code and paste it in your HTML
  1. <form action="upload.php" method="post" enctype="multipart/form-data">
  2. <input name="upload_files[]" type="file" multiple>
  3. <input type="submit" value="Upload">
  4. </form>
  6. <?php
  7. // PHP code
  8. that shows how to loop through the data as an array
  9. foreach($_FILES["upload_files"]["name"] as $file){
  10. echo "<li>".$file."</li>";
  11. }
  12. ?>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.