Copy link to clipboard
Copied
Hello;
I wrote a cfmail app that allows you to send one attachment. Everything about it works fine. The problem is, it's sending 2 of the uploaded image and I can't figure out why. I'm not going to put in all my error code and so on, I'm just showing my cffile, and then the main part of my cfmail, I believe the problem is in how I'm attaching my file that is to be uploaded from the user.
<cffile action="upload"
filefield="attachment_1"
destination="c:\websites\187914Kg3\uploads\"
nameconflict="Makeunique" accept="#request.AcceptImage#">
<cfmail to="test@gmail.com"
cc="another@gmail.com"
from="#form.email#"
subject="Submitted Idea"
type="html" SpoolEnable="no"
server="mail.gmail.com"
port="25">
<cfmailparam name="X-Priority" value="1"/>
This is all my email stuff from the forms
<cfsilent>
<cfif FORM.attachment_1 neq "">
<cfmailparam file="#attachment_local_file_1#">
</cfif>
</cfsilent>
<cfmailparam file="#CFFILE.ServerDirectory#/#CFFILE.ServerFile#" remove="true"/>
</cfmail>
and that's the main part of it aside from the form to send, and error control and those things.
Can anyone see what I'm doing wrong here? possibly help me fix my issue?
Thank you.
You have 2 cfmailparam tags therefore there are 2 copies of the attachment. Remove the cfmailparam outside the cfif statement. You may need to add the delete="true" to the cfmailparam inside the cfif tag.
Copy link to clipboard
Copied
You have 2 cfmailparam tags therefore there are 2 copies of the attachment. Remove the cfmailparam outside the cfif statement. You may need to add the delete="true" to the cfmailparam inside the cfif tag.
Copy link to clipboard
Copied
Thank you! that worked. I was over thinking the process. Using a 2nd tag to delete the image on the server and I didn't need too. did what you said and it works perfect.