This all worked under an older version of PHP, and I know exactly where and what the problem is. Just not sure how to fix it.
I have a form that has other forms of input but this is the part I need help with.
Attachment(s):<br> <input type="file" name="uploadfile[]"/><br>
<input type="file" name="uploadfile[]"><br>
<input type="file" name="uploadfile[]"><br>
And the code that deals with the file inputs:
$total = count($_FILES['uploadfile']['tmp_name']);
for ($i = 0; $i = $total; $i++) {
$name = $_FILES['uploadfile']['name'][$i];
$path = $_FILES['uploadfile']['tmp_name'][$i];
$mail->AddAttachment($path,$name);
}
Now the problem is, unless all three inputs from the form have a file in them, it throws an error if there is only one file it gives:
"could not access file. Could not access file". (2 errors)
If there are two files it gives:
"Could not access file" (1 error)
and if there are three files there is no error.
So I know it is in the count() function that is the issue