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 50 posts at DZone. View Full User Profile

Multiple File Input in HTML

  • submit to reddit
<!-- source: -->
<form action="upload.php" method="post" enctype="multipart/form-data">
  <input name="upload_files[]" type="file" multiple>
  <input type="submit" value="Upload">
// 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.


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