Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

mail form with attachment "browse" for file

Status
Not open for further replies.

fiuPikeOY

Programmer
Jun 14, 2004
143
US
Hello,

I'm trying to create a form that will be emailed, but I want it to have the capability to browse and attach a file to the email. Is that possible? Can someone point me in the right direction to learn how to do this.

Thanks in advance
 
First thing you'd need to do is add a file dialog, which is more HTML than cold fusion. Then once you submit the page, you take the contents of the file dialog, and use CFFILE to upload that file, then save it to your server somewhere. You have to pick a plethora of options, like how to handle existing filenames, etc, but thats basically how you would do something like that.

Also make sure that your form tag has the follow attribute:

ENCTYPE="multipart/form-data"

(ie <form name="blah" method="..." action="..." ENCTYPE="multipart/form-data">

Or it won't work.

Hope that helps.
MG
 
But how do I send it from the server to someone's email?

Is there a completed example somewhere of this.

Thanks
 
So then

"form action="emailSent.cfm" method="post" name="emailForm" id="emailForm" ENCTYPE="multipart/form-data onsubmit="return validateForm(this);"

and then I should handle all the actual sending of the email in emailSent.cfm

Correct?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top