Page 1 of 1

Need Mail attachements Help on phpMailer

Posted: Fri Jan 05, 2007 3:40 am
by Kanchana
I’m using phpMailer to send emails. The user is entering the mail info by using a web form. The attachment is taken from a file field. The attachment dose not attach on a client machine (it works on the server). Part of the coding is below.

Code: Select all

$File =$_POST['filefield']; // path comes as “C:/test/file.txt”
$mail->WordWrap = 50;
$mail->IsHTML(true);
$mail->Subject = "Here is the subject";
$mail->Body    = "This is the HTML message body <b>in bold!</b>";
$mail->AddAttachment("$File");

Can you help me to run this on a client machine…..?

Posted: Fri Jan 05, 2007 6:33 am
by Chris Corbyn
You can't run PHP code on a client machine... Are you looking to attach a file directly from the client's computer? You'll have to have the client upload the file through a <input type="file" .. /> and attach it from $_FILES.

Posted: Fri Jan 05, 2007 9:32 pm
by Kanchana
Yes i want to the script to be running on a client machine and at the same time I’m using a <input type="file" .../> to get the attachment. Please be kind enough to show me how to get the path of the attachment by using the $_FILES. I’m bit confused in using it......

Posted: Fri Jan 05, 2007 9:43 pm
by feyd

Posted: Fri Jan 05, 2007 11:12 pm
by Kanchana
it worked thanks for the help....