Formmail and pic uploads

apps

#1

We are using formmail for a site and would like to have the ability for visitors to use a browse button to select a file (picture) from their system - which would then forward to us (upload to us) along with the information we’re collecting in the formmail. Can this be done with formmail?


#2

This can be done of course. However I read here that DreamHost’s http://formmail.dreamhost.com is based on the FormMail program available from http://nms-cgi.sourceforge.net/. However neither party seems to have implemented such functionality.

Uploading files by a form is not a simple matter. For files of a siginificant size you have to worry about the client canceling the upload before it has completed. More importantly are security and reliability concerns such as making sure the CGI application isn’t vulnerable to malicious attacks or even a self-inflicted DoS. Also you have to take additional steps to process such forms.

I’ve seen scripts address the first issue by making the client submit a regular form as well as an upload form consecutively. The order probably depends on whether or not the file is optional or required.

Upload forms have to be submitted the client in a different format the the regular forms requiring the CGI application to be able to parse this less common format. In addition to handling large amounts of data it must also be able to create messages with attachments. So not just any formmail script will do. And it might not be a good idea send the file as an attachment in case it is the wrong file or trojan/virus/etc. Personally I’d leave the file on disk and include a reference to it in the e-mail message.

:cool: Perl / MySQL / HTML+CSS