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[\
Agreeing with @patapizza, but before you check on the filesystem (which you should do anyway), you can also just check for $_FILES like
for ($i = 0; $i < count($_FILES); $i++){ // only iterate over the number of files you actually have }