Simple Coldfusion Upload Script
This tutorial will take you through the basics of creating a simple Coldfusion upload script. This script is ideal for uploading any file types. I will later be adding a tutorial on advanced file uploading with file type validation and size limiting.
To create an upload script the first thing we need is a form to select the file, so here is a quick example of a simple form with a file field and a submit button that submits to the current page.
<form action="<cfoutput>#CurrentPage#</cfoutput>" method="post" enctype="multipart/form-data" name="Upload" id="Upload"></form>
<input type="file" name="File"/>
<input type="submit" name="Upload" value="Upload"/>
<cffile action="upload" destination="D:\Domains\cfproject.co.uk\wwwroot\ColdfusionSamples\upload" filefield="FORM.File" nameconflict="overwrite">
File Uploaded!
</cfif>
<cffile action="upload" destination="D:\Domains\cfproject.co.uk\wwwroot\ColdfusionSamples\upload" filefield="FORM.File" nameconflict="overwrite">
File Uploaded!
</cfif>
<cfset CurrentPage=GetFileFromPath(GetTemplatePath())>
<form action="<cfoutput>#CurrentPage#" method="post" enctype="multipart/form-data" name="Upload" id="Upload">
<input type="file" name="File"/>
<input type="submit" name="Upload" value="Upload"/>
</form>

The start tag must have a matching end tag. An explicit end tag can be provided by adding </cfoutput>. If the body of the tag is empty you can use the shortcut <cfoutput .../>.