Developing ColdFusion Applications
|
|
Managing Files on the Server
|
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 in the following table 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.
Action |
Example code |
Move a file
|
<cffile action="Move"
source="c:\files\upload\KeyMemo.doc"
destination="c:\files\memo\">
|
Rename a file
|
<cffile action="Rename"
source="c:\files\memo\KeyMemo.doc"
destination="c:\files\memo\OldMemo.doc">
|
Copy a file
|
<cffile action="Copy"
source="c:\files\upload\KeyMemo.doc"
destination="c:\files\backup\">
|
Delete a file
|
<cffile action="Delete"
file="c:\files\upload\oldfile.txt">
|
Copyright © 2001, Macromedia Inc. All rights reserved. |
|