Re: Sending Attachements through php email form

From: Date: Wed, 11 Sep 2002 12:32:59 +0000
Subject: Re: Sending Attachements through php email form
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-115962@lists.php.net to get a copy of this message
Hi, I'm not aware of any existing code/samples for this, but the individual components you need to break it down into are pretty straight forward: 1. Learn about forms, validation of user input, and in particular file uploads (which there is a perfect library of working code in the manual: http://www.php.net/manual/en/features.file-upload.php) 2. Then learn about the filesystem functions, in particular, how to read the contents of the uploaded file into a string, then later about deleting files, etc etc. from the manual http://php.net/fread: <? // get contents of a file into a string $filename = "/usr/local/something.txt"; $fd = fopen ($filename, "r"); $contents = fread ($fd, filesize ($filename)); fclose ($fd); ?> 3. Then learn a bit about mail() (http://php.net/mail), but really what you need to do from there is to go over to phpclasses.org, and look at manual lemos' mime-mail class (unsure of the exact name), which deals with HTML mail, multi part email, attachments to emails, and everything else you could possibly need to send an email with an attachment. Justin on 11/09/02 12:07 AM, Heidi Belal (hbmaillists@yahoo.com) wrote: > > Hi, > > I was wondering if anybody could tell me the best way and how to code sending > an attachement with an email form. I want the user to be able to browse and > select the file he wants to attach, and i want the reciepent to be able to see > the file that has been attached with the email. > > Thanks, > > > > Heidi Belal > Web Developer > www.code-corner.com > > A bus stops at a bus station; > a train stops at a train station; > and on my desk i have a work station ... > > > > > > --------------------------------- > Yahoo! - We Remember > 9-11: A tribute to the more than 3,000 lives lost

« previous php.general (#115962) next »