After a file upload is completed, you can retrieve status information using file upload variables. This status information includes a wide range of data about the file, such as the file's name and the directory where it was saved.
Although you can use either the File or cffile prefix, for file uploaded status variables, cffile is preferred; for example, cffile.ClientDirectory. (The File prefix is retained for backward compatibility.) You can use the file status variables anywhere that you use ColdFusion variables.
The following table describes the file status variables that are available after an upload:
Variable |
Description |
---|---|
attemptedServerFile |
Initial name ColdFusion used attempting to save a file, for example, myfile.txt . See "Resolving conflicting filenames". |
clientDirectory |
Directory on the client's system from which the file was uploaded. |
clientFile |
Full name of the source file on the client's system with the file extension; for example, myfile.txt. |
clientFileName |
Name of the source file on the client's system without an extension; for example, myfile. |
clientFileExt |
Extension of the source file on the client's system without a period; for example, txt not .txt. |
contentSubType |
MIME content subtype of the saved file, such as gif for image/gif . |
contentType |
MIME content type of the saved file, such as image for image/gif . |
dateLastAccessed |
Date that the uploaded file was last accessed. |
fileExisted |
Indicates (Yes or No) whether the file already existed with the same path. |
fileSize |
Size of the uploaded file. |
fileWasAppended |
Indicates (Yes or No) whether ColdFusion appended the uploaded file to an existing file. |
fileWasOverwritten |
Indicates (Yes or No) whether ColdFusion overwrote a file. |
fileWasRenamed |
Indicates (Yes or No) whether the uploaded file was renamed to avoid a name conflict. |
fileWasSaved |
Indicates (Yes or No) whether ColdFusion saved a file. |
oldFileSize |
Size of a file that was overwritten in the file upload operation. Empty if no file was overwritten. |
serverDirectory |
Directory where the file was saved on the server. |
serveFile |
Full name of the file saved on the server with the file extension; for example, myfile.txt. |
serverFileName |
Name of the file saved on the server without an extension; for example, myfile. |
serverFileExt |
Extension of the file saved on the server without a period; for example, txt, not .txt. |
timeCreated |
Date and time the uploaded file was created. |
timeLastModified |
Date and time of the last modification to the uploaded file. |
Note File status variables are read-only. They are set to the results of the most recent |