I have the following code in PHP, using PHPMailer to email files from a multiple upload, is working the problem is that in the email the name of the files gets the name of the tmp folder for example: "/ tmp / php / Z9MDY7" instead of the name of the file that was attached, but in the folder of the server where these files go, the name is correct, what could it be?
Code:
$total = count($_FILES['pdfanexo']['name']);
for($i=0; $i<$total; $i++) {
$tmpFilePath = $_FILES['pdfanexo']['tmp_name'][$i];
if ($tmpFilePath != ""){
$newFilePath = "Marcas/" .$vregistro. $d. "/". $_FILES['pdfanexo']['name'][$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
$mail->addAttachment($newFilePath, $tmpFilePath); //Attachment Documentos Múltiplo Upload (PDF-DOCUMENT)
}
}
}