|
ColdFusion Home
Basic ColdFusionIntroductionColdFusion Installation ColdFusion Editors ColdFusion Syntax ColdFusion Includes ColdFusion Variables ColdFusion Variable Types ColdFusion If Statements ColdFusion Loops ColdFusion Datasource ColdFusion Database Queries ColdFusion Lists ColdFusion Arrays ColdFusion Redirect ColdFusion Debugging ColdFusion Error Handling Advanced ColdFusionColdFusion MailColdFusion Functions ColdFusion Components ColdFusion Web Services ColdFusion Upload File ColdFusion Read File ColdFusion Write File ColdFusion Append File ColdFusion Rename File ColdFusion Copy File ColdFusion Move File ColdFusion Delete File Cffile Parameters Using cffile Parameters ColdFusion FTP (cfftp) cfftp Cached Connections ColdFusion HTTP (cfhttp) ColdFusion Query of Queries ColdFusion Charts ColdFusion Summary ColdFusion AdminCF AdministratorCF Archive and Deploy CF Scheduled Tasks CF Mini Tutorial ColdFusion BooksColdFusion MX BibleMacromedia ColdFusion MX 7 Web Application Construction Kit Got a MySpace Page?Get "www.yourname.com" for your MySpace page. Learn how >>. |
ColdFusion Delete FileYou can use the cffile tag to delete a file from the server. Example of Deleting a FileThe following code deletes the file specified with the file attribute.
Checking that the File ExistsThe 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:
Sorry, can't delete the file - it doesn't exist.
Enjoy this website?
Oh, and thank you for supporting Quackit! |
Featured Template:
(Build your websites in minutes!) |