I\'m using this to attach files to an mail after uploading them to my server:
for ($i = 0; $i <= 2; $i++)
{
$mail->AddAttachment($locatie.$_FILES[\
for ($i = 0; $i <= 2; $i++)
{
if (file_exists($locatie.$_FILES['uploaded'.$i]['tmp_name'])) {
$mail->AddAttachment($locatie.$_FILES['uploaded'.$i]['tmp_name'], $_FILES['uploaded'.$i]['name']);
}
}
You were using $locatie.$_FILES['uploaded'.$i]['name'] instead of $locatie.$_FILES['uploaded'.$i]['tmp_name'] as the file to load. When a file is uploaded it is renamed with a temporary name and placed on the temporary folder. That's where you will get it, and that's why you need to reference it with $locatie.$_FILES['uploaded'.$i]['tmp_name']