ColdFusion Delete File
You can use the
<cffile> tag to delete a file from the server.
Example of Deleting a File
The following code deletes the file specified with the
Checking that the File Exists
The above code will work properly if the file actually exists. If the file doesn't exist, the user will receive an error.
You can use the built in ColdFusion
FileExists() function to check if the file exists. By using this as an expression in a
<cfif> statement, you can determine what to do if the file doesn't exist.
If the file doesn't exist, the following message will be displayed to the user:
Here's the full syntax of
Here's Adobe's documentation for
cffile="delete" if you're interested.