Question

Is there a ColdFusion 10 function that checks to see if a file on the web server is locked? I'm trying to upload a file and delete it or use it for other functions, but when I go to delete the file, the code is executing quicker than the web server can finish uploading it. I came to this conclusion by deleting an older file from the directory and it worked just fine. Is there a ColdFusion function I can check to see if the file is unlocked? Otherwise, I'll get this error.

coldfusion.tagext.io.FileUtils$CouldNotDeleteFileException: 
ColdFusion could not delete the file D:\webServer\confusedDeer.txt 
for an unknown reason.
Was it helpful?

Solution

In CFML? No. However you can check if you can write to or read a file before doing so via methods of java.io.File.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top