PDA

View Full Version : email/attachement (.pdf files) and automation. advice needed.


jeskel
09-10-2004, 03:44 PM
Hi,

I am posting this thread to know how hard it is to achieve something like this and how I should process:

-users will submit a form in which they will provide a few personnal info as well as the name of a .pdf file. There will be a choice of something like 30 .pdf files and the user will only select one per form (the choice will be made based on the file name).

-Once the form submited, the data will be stored in a db. The admin of the site check all the submited data. If he notices a funky/bogus name, he will delete the data in question. If everything seems alright, the admin will click on a 'process' button, or something like that-

-Here is what happens when the 'process' button is being clicked: An email (only a few words) is sent to the user who submited the form at the address he/she provided. This email will have an attachement of the .pdf file chosen by the user. As you can guess, this needs to be automated.

So here are a few questions:
-how hard is it to add an attachement to an email using PHP?

-how can I attach the file requested based on the name submited (choices -when submiting the form- will be made using a drop down menu in order to avoid typos and such problems)? I mean, if the user choses to receive a file named 'thisfile.pdf', is it possible to automatically attach this file?

-The .pdf files must not be accessible if the user has not submited a form and if the admin has not 'processed' the user in question, so I thought about storing them above the web directory. Is that a good idea? Is that a problem for the attachement part?

Thanks in advance for your help and your advice. :)

bcarl314
09-10-2004, 03:57 PM
Yes, it's failry easy to attache .pdf files (or any other for that matter).

Check out this page: http://www.aphion.com/class/class9/attach.html

(username=forumsuser, password=forumspass)

Storing the files outside of the webroot is also a good idea. Just make sure the directory / files are readable by apache.

jeskel
09-10-2004, 07:34 PM
thanks a lot for this link :)

I will work on that.