Skip to content

Instantly share code, notes, and snippets.

@tiagodavi
Created October 26, 2015 22:50
Show Gist options
  • Save tiagodavi/27b66dce66ae02f3e26e to your computer and use it in GitHub Desktop.
Save tiagodavi/27b66dce66ae02f3e26e to your computer and use it in GitHub Desktop.
It does multiple upload with php
<?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