This might seem like an easy question, but...
I'm running a script that dynamically generates a postscript file, saves it to a temp directory and then generates an HTML link to the file. So when you hit the go button, you get a link to download the file.
To allow for multiple users, I'm using a unique ID scheme, where the file name is assigned a random number, so that no two users are assigned the same file name at the same time. The problem with this, is that the files never are deleted or overwritten from the temp folder.
Is there an easy way to delete the temp file after the user leaves the page (navagates away or closes the window)? I tried using crontab to schedule a mass delete of the contents of the folder every day at midnight, but that's more of a workaround then a solution.
I'm running a script that dynamically generates a postscript file, saves it to a temp directory and then generates an HTML link to the file. So when you hit the go button, you get a link to download the file.
To allow for multiple users, I'm using a unique ID scheme, where the file name is assigned a random number, so that no two users are assigned the same file name at the same time. The problem with this, is that the files never are deleted or overwritten from the temp folder.
Is there an easy way to delete the temp file after the user leaves the page (navagates away or closes the window)? I tried using crontab to schedule a mass delete of the contents of the folder every day at midnight, but that's more of a workaround then a solution.