|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
PhpMailer attachment problem - phpb8146X instead of picture.jpg
Howdy,
I have a serious problem using the class phpMailer Everything works finr instead of the attachment filename. When I select a file for example apple.jpg and then press the submit button in my form, the data is processed with send.php code and send to my address. It is OK, but if I take a look at my attachement in my email client. it is called phpb8146X instead of apple.jpg. The attached file called phpb8146X has the same size as the original picture apple.jpg If i try to rename the file to apple.jpg or just add the .jpg suffix, and bingo! It works like a charm and i can open the picture in every image viewer. So my question is, why the phpMailer change the name of my attached file? If someone know how to solve this problem let me know. I guess it has something to do with this line this is send.php require("class.phpmailer.php"); $mail = new PHPMailer(); $mail->IsSMTP(); $mail->Host = "smtp.something.com"; // lang $mail->CharSet="utf-8"; $mail->From = $from; $mail->FromName = "girllekvarnica"; $mail->AddAddress("girllekv@something.com"); $mail->Subject = "mysubject"; $mail->AddAttachment($myfile); $mail->Encoding = "base64"; $mail->Body = $mybody; $mail->WordWrap = 50; if(!$mail->Send()) { echo 'bad: ' . $mail->ErrorInfo; } else { echo 'OK'; } this is my form index.html <HTML> <HEAD> <TITLE>bla mail</TITLE> <meta http-equiv="content-type" content="text/html;charset=utf-8"> </HEAD> <BODY> <HR SIZE=1 NOSHADE> <FORM ACTION="send.php" METHOD="post" ENCTYPE="multipart/form-data"> From: <INPUT TYPE="text" NAME="from" VALUE="" SIZE=50 MAXLENGTH=50><BR> To: <INPUT TYPE="text" NAME="girl" VALUE="" SIZE=50 MAXLENGTH=50><BR><BR> Text:<BR> <TEXTAREA NAME="mybody" COLS="50" ROWS="10"></TEXTAREA><BR> File attach: <INPUT TYPE="file" NAME="myfile"> <BR> <INPUT TYPE="submit" NAME="gogirla" VALUE="gogirl"><BR> </FORM> </BODY> </HTML> Last edited by lekvarnica69 : October 29th, 2008 at 11:48 AM. Reason: adding some stuff |
|
#2
|
|||
|
|||
|
Depending on your configuration php may store file uploads in tmp folder with randomly generated name (like session file names).
AddAttachment can get multiple parameters: Code:
AddAttachment($path,$name,$encoding,$type); You can store the original file name then add $name value to show correct file name in the email headers. |
|
#3
|
|||
|
|||
|
By the way I think it should have been posted in the coding thread.
|
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Installation > PhpMailer attachment problem - phpb8146X instead of picture.jpg |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|