Skip to main content
June 29, 2009
Question

cffile

  • June 29, 2009
  • 2 replies
  • 505 views

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.

    This topic has been closed for replies.

    2 replies

    Dileep_NR
    Inspiring
    June 30, 2009

    Hi,

    Please check the file exists in the directory before trying to delete.

    <cfif FileExists(ExpandPath(yourfile))>

    ......

    </cfif>

    June 29, 2009

    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:

    http://blog.tygate.com/?p=403

    I was working with flex and coldfusion 8 but this might help.