I'm using the in-memory file system to execute dynamic CFM files. How can I delete the temporary file only AFTER it is finished running? If I do it right after the cfinclude, it won't get deleted if the dynamic code has an abort or location tag etc. Can I create a thread that will sleep till the main page thread completes and then delete it?
Asked
Active
Viewed 68 times
1
-
Put them all in a certain directory and set up a scheduled job to delete them. – Dan Bracuk Oct 15 '15 at 18:57
-
A thread should work too, see the docs of `cfthread`. – Alex Oct 16 '15 at 12:37
-
Would it be possible to include a call to code to delete the file from within the dynamic cfm file itself? – Steve Bryant Oct 16 '15 at 15:22
-
That would bring you back to the same problem of the abort. – Dan Bracuk Oct 22 '15 at 02:05
-
Steve Bryant, I have tried including the code on top of the dynamic cfm file. However if there is a compilation error none of it will run and the file will not get deleted. – Cabby Oct 23 '15 at 13:13
-
How about putting the delete code in `onRequestEnd()` in `application.cfc` ? – James A Mohler Dec 04 '15 at 16:36