Posted By

apphp-snippets on 03/11/13


Tagged

html upload multi


Versions (?)

Multiple File Input in HTML


 / Published in: HTML
 

URL: http://www.apphp.com/index.php?snippet=html-multiple-file-input

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.

  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>
  5.  
  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  

You need to login to post a comment.