<cfparam name="FORM.email" type="string" default="" />
<cfparam name="FORM.file" type="string" default="" />
<cfif (
IsValid( "email", FORM.email ) AND
Len( FORM.file )
)>
<cffile
action="upload"
filefield="file"
destination="#ExpandPath( './' )#"
nameconflict="makeunique"
/>
<cfmail
to="#FORM.email#"
from="ben@bennadel.com"
subject="File Send by #FORM.email#"
type="html">
<p>
The following file has been upload and sent from
the Kinky Solutions CFMailParam Remove Attribute
demo page. <em>(Please see attached file)</em>.
</p>
<cfmailparam
file="#CFFILE.ServerDirectory#/#CFFILE.ServerFile#"
remove="true"
/>
</cfmail>
</cfif>
<cfoutput>
<!DOCTYPE html PUBLIC "- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>CFMailParam Remove Attribute Demo</title>
</head>
<body>
<h1>
CFMailParam Remove Attribute Demo
</h1>
<form
action="#CGI.script_name#"
method="post"
enctype="multipart/form-data">
<label>
Email Address:<br />
<input type="text" name="email" size="40" />
</label>
<br />
<br />
<input type="file" name="file" size="60" />
<br />
<br />
<input type="submit" value="Send File" />
</form>
</body>
</html>
</cfoutput>