Skip to content

Instantly share code, notes, and snippets.

@apphp-snippets
Created February 11, 2013 08:43
Show Gist options
  • Save apphp-snippets/4753303 to your computer and use it in GitHub Desktop.
Save apphp-snippets/4753303 to your computer and use it in GitHub Desktop.
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.
<!-- source: http://www.apphp.com/index.php?snippet=html-multiple-file-input -->
<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>";
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment