I m sending an Email with multiple attachments through phpmailer. The loop i used to send multiple attachments is The Message going with attachment, only contain the last choosen file, and the first two or one files are not sent. Is there a problem with Loop. Please :
[php] foreach($_FILES as $key => $file){
$target_path = “uploads/”;
$target_path = $target_path .basename($file[‘name’]);
if(move_uploaded_file($file[‘tmp_name’], $target_path)) {
echo “the file “.basename($file[‘name’]).” has been uploaded”;
}else {
echo “there was an error”;
}
mail->AddAttachment($target_path);
}
<form id=
"mail" name="mail" method="POST" action="<?php $PHP_SELF ?>"
enctype="multipart/form-data">
<input type="file" name="uploaded" multiple="" />
<input name="Submit1" type="submit" value="Submit" />
</form>[/php]