Copy link to clipboard
Copied
I am using a cffile to delete a file from a directory on my server. On occasion I get an error stating that the file doesn't exist when in fact it does. I am using an absolute directory path: here is an example for my code.
<cfif isDefined("Form.filename")>
<cffile action="delete" file="C:\root\images\#Form.filename#">
</cfif>
Prior to this running, I am uploading a file with a different name in the same directory.
Copy link to clipboard
Copied
I had something to the same issue you are having, and after pulling almost all my hair out over several weeks, I cam across this.
#71110 page 16 in http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf
'Under heavy load, the cffile tag might attempt to create two temporary files with the same
name, resulting in problems such as missing file errors when trying to access a file.'
Althought I had different names, there is a hot fix out there that helped me.
The fix that helped me was:
I was working with flex and coldfusion 8 but this might help.
Copy link to clipboard
Copied
Hi,
Please check the file exists in the directory before trying to delete.
<cfif FileExists(ExpandPath(yourfile)
)>
......
</cfif>