I'm having a hard time with cffile delete in one section of a project I'm
working on and I'm hoping someone has come across it before.
Here is the problem. In this project, users are allowed to add photos to the
website, which is to say, upload photos to the server and insert records into a
Once an image is uploaded, it is copied and scaled down to fit on the next
screen, (photoForm.cfm), which allows users to add a title and caption for
their new photo. So far, this works great. My problem comes up when a user
wants to "cancel" the process, ie remove the record from the database and
delete the original image as well as the second image.
When coldfusion tries to delete the second image, it returns " ColdFusion
could not delete the file "c:/images/secondImage.jpg" for an unknown reason".
I've tried putting the cffile delete code on another page and sending the user
there to do the dirty work, hoping that changing cfm pages would help, but no
If I comment the image out of photoForm.cfm, everything goes right. It seems
as if the coldfusion continues to use the image even after the user has moved
to a new page.
I have also tried putting coldfusion "to sleep" hoping to wait it out, before
deleting the files, but this has mixed results.
Has anyone ever seen this before?
Thanks in advance for your help,