Created
October 26, 2015 22:50
-
-
Save tiagodavi/27b66dce66ae02f3e26e to your computer and use it in GitHub Desktop.
It does multiple upload with php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//phpinfo(); | |
$multiple_upload = function (array $inputs){ | |
$result = array(); | |
if($inputs){ | |
foreach($inputs as $key => $index){ | |
if(is_array($index)){ | |
foreach($index as $i => $value){ | |
$result[$i][$key] = $value; | |
} | |
}else{ | |
$result[0][$key] = $index; | |
} | |
} | |
} | |
return $result; | |
}; | |
$pic = $multiple_upload($_FILES['pic']); | |
echo '<pre>'; | |
print_r($pic); | |
?> | |
<form action="info.php" enctype="multipart/form-data" method="post"> | |
<input class="tf" type="file" name="pic[]" accept="image/*"> | |
<input class="tf" type="file" name="pic[]" accept="image/*"> | |
<input class="tf" type="file" name="pic[]" accept="image/*"> | |
<input class="tf" type="file" name="pic[]" accept="image/*"> | |
<input type="submit" value="enviar"> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment