COLDFUSION :: looking for guideline to upload image and then send as e-mail attatchment

252 Views Asked by At

I have a form that can be used to uplocad pictures, and after uploading the pictures will be sent as e-mail attatchemnt to website admin and then the images will be deleted from Server.

Any guide line?

Thanks in advance.

2

There are 2 best solutions below

0
On

Attaching the file to the email is straight forward, and is achieved by using the mimeattach attribute within the cfmail tag, like so:

<cfmail to="toAddress"
 from="fromAddress"
 subject="subject"
 type="text"
 mimeattach="path of file to attach, e.g: C:/generated/businessProposal.pdf">
0
On

You can attach the file using the method Matt suggested, or you can use a cfmailparam tag to attach one or more files, whether they're on disk or not:

<cfmailparam file="MyFile.txt" content="#VariableWithContent#" disposition="attachment" />

If you want to attach one or more physical files on disk you can do this:

<cfmailparam file="c:\MyFile.txt" disposition="attachment" />

If you don't want to keep the file on disk after CF is done sending the email, you can add the remove attribute to the cfmailparam tag to have CF get rid of it after the email is sent:

<cfmailparam file="c:\MyFile.txt" disposition="attachment" remove="true />

HTH,

Dan