Web Form File Attachments

apps

#1

I am creating a web form that will allow people to enter details and also provide an option to attach a file. Is there a way that I can have the attachments emailed to the recipient email address along with the other info (rather than ahve the files uploaded to the server?

Thanks
Leah


#2

It’s not incredibly difficult to program a CGI script to send messages with file attachments. At least I’ve done it in Perl before. Are you actually looking for a CGI script that already has this feature?

:cool: [color=#6600CC]Atropos[/color] | openvein.org


#3

A script that I could drop in would be great as I have limited programming skills (otherwise someone who was willing to create one for me :o)


#4

While I know what you mean, it’s important to realize that the file still needs to get uploaded to the server, since you don’t have filesystem access with anything client side that you’re likely to be using.

It will be uploaded to a temporary location and will be accessible using an array, which I think is in the $HTTP_POST_FILES scope. Then you’ll have to send the mail as multi-part using that attachment. I don’t have code handy, but I’ll post back if I can track it down. Here are some good places to get started with your research in the meantime.

As you probably know, there are potential risks involved with letting people upload any sort of file through a web-accessible form, that will then be forwarded to your email. Especailly if you’re using an email client with html support or preview enabled…which you should consider not doing.

http://us3.php.net/features.file-upload

http://us3.php.net/mail
http://us3.php.net/manual/en/function.mail.php
http://www.zend.com/zend/spotlight/sendmimeemailpart1.php


#5

Thanks for the heads-up on the places for research. And I do understand the issues with the file upload - am trying to get around doing it if possible but at the stage people are still asking for it.