Before we finish with ColdFusion's
<cffile> tag, let's look at some important info regarding this tag.
When you use
<cffile> to upload a file to the server, ColdFusion automatically makes a number of file status parameters available for you for that file. During the upload operation, these parameters are available in the
Here are the file status parameters:
|Initial name ColdFusion used when attempting to save the file.
|This is the directory where the file is located on the user's computer.
|This is the name of the file on the user's computer, including the extension.
|The extension of the file on the user's computer. Doesn't include a period.
|Name of the file on the user's computer. Does not include the extension.
|MIME content subtype of the saved file. For example, the contentSubType for a Microsoft Word document might be "msword". This may differ slightly depending on your version of Word.
|MIME content type of the saved file. For example, the contentType for a Microsoft Word document is "application".
|Date and time the file was last accessed.
|Whether the file already existed with the same path. Possible values: Yes/No.
|Size of the uploaded file
|Whether the uploaded file was appended to another file. Possible values: Yes/No.
|Whether the file overwrote another file. Possible values: Yes/No.
|Whether the file was renamed to avoid a name conflict. Possible values: Yes/No.
|Whether the file was saved. Possible values: Yes/No.
|If a file is overwritten, this is the size of the file's size before it was overwritten.
|This is the directory where the file was saved on the server.
|This is the name of the file on the server, including the extension.
|The extension of the file on the server. Doesn't include a period.
|Name of the file on the server. Does not include the extension.
|Time the file was created.
|Date and time of the last modification to the file.
Note that 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.
You, as the developer, can make good use these parameters. In the next lesson, we will see how these parameters can be inserted into a database during the upload process.