Skip to main content
Inspiring
May 13, 2008
Question

attaching file to email

  • May 13, 2008
  • 2 replies
  • 381 views
i have a form that i require an individual to upload a file with. however, i am not putting the attachment in a db, i need it to simply attach to an html email message. i tried using:
<cfif DirectoryExists( ExpandPath( ".\ResumeFolder\" ) )>
<cffile action="upload"
fileField="resume"
destination="#GetTempDirectory()#"
nameconflict="makeunique"
accept="text/plain,application/msword,application/pdf,application/rtf">
Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
<cfelse>
<cfdirectory directory="#ExpandPath( ".\ResumeFolder\" )#" action="create">
<cffile action="upload"
fileField="resume"
destination="#GetTempDirectory()#"
nameconflict="makeunique"
accept="text/plain,application/msword,application/pdf,application/rtf">
Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
</cfif>

however, sometimes the emails will be received on mac computers, sometimes on pc's. i need a method that will not require an absolute path to a folder on the hard drive. is it possible to simply attach a document to an email alone?
This topic has been closed for replies.

2 replies

Inspiring
May 13, 2008
quote:

Originally posted by: sirtcarlos
i have a form that i require an individual to upload a file with. however, i am not putting the attachment in a db, i need it to simply attach to an html email message. i tried using:
<cfif DirectoryExists( ExpandPath( ".\ResumeFolder\" ) )>
<cffile action="upload"
fileField="resume"
destination="#GetTempDirectory()#"
nameconflict="makeunique"
accept="text/plain,application/msword,application/pdf,application/rtf">
Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
<cfelse>
<cfdirectory directory="#ExpandPath( ".\ResumeFolder\" )#" action="create">
<cffile action="upload"
fileField="resume"
destination="#GetTempDirectory()#"
nameconflict="makeunique"
accept="text/plain,application/msword,application/pdf,application/rtf">
Cover Letter/Resume/Writing Sample: <cfmailparam file="#resume#" />
</cfif>

however, sometimes the emails will be received on mac computers, sometimes on pc's. i need a method that will not require an absolute path to a folder on the hard drive. is it possible to simply attach a document to an email alone?

It doesn't matter what type of computer your mail recipients are using. All the directory stuff applies to your server.
Inspiring
May 13, 2008
check cfmailparam tag in the docs.

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/