User Guide
cffile 145
Note: File status parameters are read-only. They are set to the results of the most recent cffile
operation. If two
cffile tags execute, the results of the second overwrite the first, unless you have
specified a different result variable in the
result attribute.
Example
The following example creates a unique filename, if there is a name conflict when the file is
uploaded on Windows:
<!--- Windows Example --->
<!--- Check to see if the Form variable exists. --->
<cfif isDefined("Form.FileContents") >
<!--- If TRUE, upload the file. --->
<cffile action = "upload"
fileField = "FileContents"
destination = "c:\files\upload\"
accept = "text/html"
nameConflict = "MakeUnique">
<cfelse>
<!--- If FALSE, show the Form. --->
<form method="post" action=<cfoutput>#cgi.script_name#</cfoutput>
name="uploadForm" enctype="multipart/form-data">
<input name="FileContents" type="file">
<br>
<input name="submit" type="submit" value="Upload File">
</form>
</cfif>
clientFileName Name of the uploaded file on the client system (without an extension)
contentSubType MIME content subtype of the saved file
contentType MIME content type of the saved file
dateLastAccessed Date and time the uploaded file was last accessed
fileExisted Whether the file already existed with the same path (yes or no)
fileSize Size of the uploaded file
fileWasAppended Whether ColdFusion appended uploaded file to a file (yes or no)
fileWasOverwritten Whether ColdFusion overwrote a file (yes or no)
fileWasRenamed Whether uploaded file renamed to avoid a name conflict (yes or no)
fileWasSaved Whether ColdFusion saves a file (yes or no)
oldFileSize Size of a file that was overwritten in the file upload operation
serverDirectory Directory of the file saved on the server
serverFile Filename of the file saved on the server
serverFileExt Extension of the uploaded file on the server (without a period)
serverFileName Name of the uploaded file on the server (without an extension)
timeCreated Time the uploaded file was created
timeLastModified Date and time of the last modification to the uploaded file
Parameter Description