226
File Upload Variables (Continued)
Parameter
ServerFileExt
ServerFileName
TimeCreated
TimeLastModified
Use the File prefix to refer to these variables, for example, #CFFILE.FileExisted#.
Note
Moving, Renaming, Copying, and Deleting Server Files
With CFFILE, you can create application pages to manage files on your Web server. You
can use the tag to move files from one directory to another, rename files, copy a file, or
delete a file.
The examples below show static values for many of the attributes. However, the value
of all or part of any attribute in a CFFILE tag can be a dynamic parameter. This makes
CFFILE a very powerful tool.
Examples of moving, renaming, copying, and deleting server files
Action
Move a file
Rename a file
Copy a file
Delete a file
Description
Extension of the uploaded file on the server, without a
period, for example,
Filename, without an extension, of the uploaded file on
the server.
Time the uploaded file was created.
Date and time of the last modification to the uploaded
file.
File status variables are read-only. They are set to the results of the most
recent CFFILE operation. If two CFFILE tags execute, the results of the
first are overwritten by the subsequent CFFILE operation.
Example code
<CFFILE ACTION="Move"
SOURCE="c:\files\upload\KeyMemo.doc"
DESTINATION="c:\files\memo\">
<CFFILE ACTION="Rename"
SOURCE="c:\files\memo\KeyMemo.doc"
DESTINATION="c:\files\memo\OldMemo.doc">
<CFFILE ACTION="Copy"
SOURCE="c:\files\upload\KeyMemo.doc"
DESTINATION="c:\files\backup\">
<CFFILE ACTION="Delete"
FILE="c:\files\upload\oldfile.txt">
Developing Web Applications with ColdFusion
not.
.
txt
txt
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?
Questions and answers