1 Reply Latest reply on Jan 16, 2007 12:43 AM by Fernis

    Coldfusion locking files when I upload then I can't delete

    lonnborg
      I have been having a problem deleting images for a while now. Everytime I upload a file with cffile I am unable to delete it for an unknown amount of time. I cant delete it with cffile delete or even delete it on the server manually. Its not a permissions issue because I can delete other files in the folder. Just the ones that were uploaded recently cannot be deleted or renamed. I ran the process explorer and it was telling me that jrun.exe had a handle on the picture names that were not able to be deleted. Is there a way to tell jrun.exe to relese the photo before deletion?

      Process Explorer Window

      Process PID Type Handle or DLL
      jrun.exe 111580 Handle C:\Inetpub\www\website\photo i can not delete.jpg
        • 1. Re: Coldfusion locking files when I upload then I can't delete
          Fernis Level 3
          Since you mentioned JPEG, are you displaying the image just after the upload? In that case, it's the HTTP server (Apache, IIS, etc.) that's probably locking your file for a while. I don't know if there's really a way to overcome this.

          What I would do (in a Content management system, for example), would be a specific file-task queue, which stores a record in the database if the file deletion didn't work (use try-catch), and then run a specific page once in a while (cfschedule) which tries to delete the files that are waiting for their doom.