Re: Attaching File to be Emailed
| From: | Travis Doherty | Date: | Fri, 24 Nov 2006 05:30:40 +0000 |
| Subject: | Re: Attaching File to be Emailed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-245110@lists.php.net to get a copy of this message | ||
benc11@gmail.com wrote:
> I need to take a word document or pdf file from either a MySQL db or
> from a
> directory, which will then be sent via php script. How can I go about
> doing
> this? Can anyone provide sample code or point me in the right direction.
>
Brian Dunning started a thread about nine minutes before you on sending
a file to the browser. "Serving out a file to Firefox ... headers?"
That's pretty much all you need to do to read from a file (adding in
whatever fixes the problem he is experiencing with FireFox of course.)
If you wanted to store the data in a MySQL database it would be the same
procedure, except you would query the database (BLOB column type) and
echo that data instead of using readfile() to get your data.
Travis