Skip to content

Instantly share code, notes, and snippets.

@tararoutray
Last active December 20, 2021 11:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tararoutray/6d727151daf0fd2e7212bcbffc24381a to your computer and use it in GitHub Desktop.
Save tararoutray/6d727151daf0fd2e7212bcbffc24381a to your computer and use it in GitHub Desktop.
<?php
/**
* Check if the user has submitted the form.
*/
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
/**
* Print the $_FILES global variable. This will display the following:
* array(1) {
* ["myfiles"]=> array(6) {
* ["name"]=> array(2) {
* [0]=> string(9) "image.png"
* [1]=> string(9) "image.png"
* }
* ["full_path"]=> array(2) {
* [0]=> string(25) "folder1/folder2/image.png"
* [1]=> string(25) "folder3/folder4/image.png"
* }
* ["tmp_name"]=> array(2) {
* [0]=> string(14) "/tmp/phpV1J3EM"
* [1]=> string(14) "/tmp/phpzBmAkT"
* }
* // ... + error, type, size
* }
* }
*/
var_dump($_FILES);
}
?>
<form action="" method="POST" enctype="multipart/form-data">
<input name="myfiles[]" type="file" webkitdirectory multiple />
<button type="submit">Submit</button>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment