I borrowed this code from another StackOverflow question, yet for some reason I cannot get it to work. When testing it is not even passing the files. My error testing shows
total: 0
So it fails right there. Any help would be greatly appreciated
session_start();
$total = count($_FILES['upload']['name']);
echo "total: " . $total;
for( $i=0 ; $i < $total ; $i++ ) {
$tmpFilePath = $_FILES['upload']['tmp_name'][$i];
echo $tempFilePath . "<br>";
if ($tmpFilePath != ""){
$newFilePath = "/images/prod/" . $_FILES['upload']['name'][$i];
echo $newFilePath . "<br>";
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
echo $_FILES['upload']['name'];
}
}
}
<form action="addpics.php" method="get" name="add" enctype="multipart/form-data>
<input type="file" name="imgs[]" multiple>
<input type="submit" value=" - ADD - ">
</form>
Expect the files to upload to the /images/prod folder and echo the array of file names