Adding a file attach to a formmail form


I have a form that clients fill in their details and they are sent to me via formmail.

I want to add the option for them to attach a file from their computer to be sent as well as an attachment.

I have tried adding a field of type “file” and this allows then to scan for files but not actually attach them.

Any Ideas?

You have to use a formmail script that is designed to handle file uploads. In addition, the FORM must use the POST method and have the ENCTYPE attribute set to ‘multipart/form-data’

Not only that, the formmail script would have to know it was a file and generate a multipart message.

If you are using the DreamHost provided formmail facility, while it does not specifically say if file uploads are supported or not, I would be suprised if they were.

:cool: Perl / MySQL / HTML+CSS

Thanks for the reply

I have ‘post’ and ‘multipart/form-data’ already set.

Most (if not all) forms I’ve seen have an extra button that you must press to actually attach the file.

I’ve seen a bit on MIME::lite but can’t seem to see how to integrate it in to my form.

This must be fairly simple, heaps of forms out there to it.
However, there seems to be heaps of people in the same boat as me, all asking the same question.

Do you know of a formmail script that is designed to handle file uploads?

Sorry, can’t help you with finding a script somewhere else. I mostly code my own stuff and I do know how to do both file uploads and MIME messages in Perl though.

Here is a link to a Perl script I wrote. I hand-coded the MIME encapsulation, and it assumes their is only one file and that it is a JPEG image. It was a proof of concept tested locally and should not be run in a production environment without improving its security.

:cool: Perl / MySQL / HTML+CSS