DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Chara has posted 51 posts at DZone. View Full User Profile

Multiple File Input in HTML

02.13.2013
| 4044 views |
  • submit to reddit
<!-- source: http://www.apphp.com/index.php?snippet=html-5-media-code -->
<form action="upload.php" method="post" enctype="multipart/form-data">
  <input name="upload_files[]" type="file" multiple>
  <input type="submit" value="Upload">
</form>
 
<?php
// PHP code
 that shows how to loop through the data as an array
foreach($_FILES["upload_files"]["name"] as $file){
    echo "<li>".$file."</li>";
}
?>

  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.

Comments

Michael Molo replied on Tue, 2013/02/19 - 1:36am

http://getsharepoint.com/