Need Mail attachements Help on phpMailer

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Kanchana
Forum Newbie
Posts: 3
Joined: Fri Jan 05, 2007 3:33 am
Contact:

Need Mail attachements Help on phpMailer

Post 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…..?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post 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.
User avatar
Kanchana
Forum Newbie
Posts: 3
Joined: Fri Jan 05, 2007 3:33 am
Contact:

Post 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......
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
Kanchana
Forum Newbie
Posts: 3
Joined: Fri Jan 05, 2007 3:33 am
Contact:

Post by Kanchana »

it worked thanks for the help....
Post Reply