sending files to e-mail along with form in php

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
breed
Forum Newbie
Posts: 1
Joined: Sat Sep 25, 2004 7:46 am

sending files to e-mail along with form in php

Post by breed »

Hi
(the usual declaration) I'm a newbie to php,
What I'm after is help for the following. I have a form (php) set up on my website, which works very well, once completed the form send all the info to my e-mail account.

I have been looking for code or examples that will allow the user to upload files (jpgs, gifs, ect). I have seen quite a few coded examples that stores the attched files on the server, but nothing that will send files directly to my e-mail. Can this be done?

I'd be grateful for any help with this
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you just need to change the upload script handler to encode the file for email, and send it.. instead of saving it to the filesystem. If you search for [devnet]+mail +attach*[/devnet] you'll find many threads about attachments and the [php_man]mail[/php_man] function.

First, I'd get the file upload processor working. Then I'd get an email script working. Then I'd adjust that email script to send an attachment. Then I'd join the two into a single set of functions using a common interface, so it's more hot pluggable.
Post Reply