php how to attach multiple file code example
Example 1: upload multiple files in php
$files = array_filter($_FILES['upload']['name']);
$total_count = count($_FILES['upload']['name']);
for( $i=0 ; $i < $total_count ; $i++ ) {
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
if ($tmpFilePath != ""){
$newFilePath = "./uploadFiles/" . $_FILES['upload']['name'][$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
}
}
}
Example 2: php include multiple files at once
array_map( function ($a) { return include($a); }, array('xx.php','yy.php','zz.php'));