Upload Files with Coldfusion
1. Create a new page in DW and save it as "uploadfile.cfm".
2. Create a normal form with a file field.
<form action="uploadfile.cfm" method="POST" name="frmupload" enctype="multipart/form-data">
<input type="file" name="file_path">
<input type="submit" name="submit_upload" value="upload">
</form>
3. We will send the form to the same page and perform the upload here too. Add the following code above the <form> tag we just created:
<cfif isdefined("form.submit_upload")>
<cffile action="UPLOAD" filefield="file_path" destination="C:\Documents and Settings\Administrator\Desktop" nameconflict="MAKEUNIQUE">
File Uploaded!
</cfif>
FULL CODE:
<html><head><title>Upload File with Coldfusion</title></head><body>
<cfif isdefined("form.submit_upload")>
<cffile action="UPLOAD" filefield="file_path" destination="C:\inetpub\wwwroot" nameconflict="MAKEUNIQUE">
File Uploaded!
</cfif>
<form action="uploadfile.cfm" method="POST" name="frmupload" enctype="multipart/form-data">
<input type="file" name="file_path">
<input type="submit" name="submit_upload" value="upload">
</form>
</body></html>

Recent comments
6 weeks 5 days ago
6 weeks 5 days ago
10 weeks 1 day ago
10 weeks 6 days ago
10 weeks 6 days ago
13 weeks 6 hours ago
25 weeks 6 days ago
25 weeks 6 days ago
26 weeks 1 day ago
26 weeks 2 days ago