Ho un problema ad aggiungere allegati con la classe Phpmailer, tramite un form contenuto in un sito.
la mail viene inviata correttamente ma al posto del file allegato che volevo inviare, c è un file temporaneo.
es : C:\PHP\uploadtemp\phpBD6.tmp
ovviamente non è sempre lo stesso, ogni volta che provo cambia il nome del file.
come posso risolvere questa cosa?
vi posto anche il codice
codice:<?php if ($_REQUEST['Invia']) { //aggiungo gli allegati move_uploaded_file ($file, "$file_name") or die ("Impossibile uplodare il file sul server"); echo "allegato: "; echo $file; echo "<img src=\"".$file."\">"; include ("class.phpmailer.php"); //creazione istanza phpmailer $mail = new phpmailer(); //seleziona il protocollo SMTP come modalità di spedizione $mail->IsSMTP(); //nome dominio $mail->Host = "smtp.miosito.it"; //segnala che è richiesta l autenticazione $mail->SMTPAuth = TRUE; //indicazione nome utente e password $mail->Username = 'miamail@miosito.it'; $mail->Password = 'password'; //mittente $mail->From = $_REQUEST['From']; $mail->FromName = $_REQUEST['FromName']; //$mail->From = "miamail@miosito.it"; //$mail->FromName = "preventivi stella"; //destinatario //$mail->AddAddress($_REQUEST['TO'], $_REQUEST['ToName']); $mail->AddAddress('miamail@miosito.it'); $mail->AddAttachment($file); //oggetto e testo del messaggio $mail->Subject = $_REQUEST['Subject']; $mail->Body = $_REQUEST['Message']; //formato testo o html $mail->IsHTML = (boolean) $_REQUEST['FormatoHTML']; if($mail->IsHTML) $mail->AltBody = strip_tags($_REQUEST['Message']); if($mail->Send()) { echo "<h2> Messaggio inviato con successo!</p></h2>"; } else { echo " Errore: ".$mail->ErrorInfo."</p>"; } } ?> <form method="post" enctype="multipart/form-data"> <table> <tr> <td>Nome del mittente: </td> <td><input type="text" name="FromName" size="40" value="<?= htmlspecialchars($_REQUEST['FromName']) ?>"></td> </tr> <tr> <td>Email del mittente: </td> <td><input type="text" name="From" size="40" value="<?= htmlspecialchars($_REQUEST['From']) ?>"></td> </tr> <tr> <td>Oggetto: </td> <td><input type="text" name="Subject" size="40" value="<?= htmlspecialchars($_REQUEST['Subject']) ?>"></td> </tr> <tr> <td>Messaggio: </td> <td><textarea name="Message" rows="7" cols="40"><?= htmlspecialchars($_REQUEST['Message']) ?></textarea></td> </tr> <tr> <td>Pima foto: </td> <td><input type="file" name="file" size="40"></td> </tr> <tr> <td></td> <td><input type="submit" name="Invia" value="Invia messaggio"></td> </tr> </table> </form>