Page 1 of 1
temporary upload
Posted: Wed Jan 29, 2003 6:11 pm
by chris12295
i am using uniqid() to make a random file name and copy() to place it in a /tmp directory, its an image file, and i want the file to automatically unlink after 5 minutes, is this possible?
Posted: Wed Jan 29, 2003 9:57 pm
by fractalvibes
Cannot think of anything efficient...what is it you are trying to accomplish?
Why must the file be copied and then deleted in 5 minutes?
If we know the overall process and how this fits into the process, some better answers might be forthcoming.
Phil J.
Posted: Wed Jan 29, 2003 11:33 pm
by chris12295
i have a script that eventually will insert data into a database if a crediat card is succesfully processed. however, the user needs to know his/her information was correct before they pay so i temporarily display all their info inluding pictures. the pictures are not stored in their permanent locations unless the credit card is processed so i need the "PREVIEW" pics to be temporary and delete themselves after 5 minutes to avoid thousands of temporary pics accumulating in my tmp directory.
process:
1. user enters info and selects pics to upload
2. data goes to validation script which shows a confirmation of purchase (inluding all info and a preview of their selected pic which has been copied to the tmp directory)
3. user accepts and form goes to credit card processor (tmp pics deleted after 5 mins)
4. credit card is accepted then data is inserted and pics are permanently copied to user directory.
Posted: Thu Jan 30, 2003 1:03 am
by volka
if you write your own session handler you may delete temp. data whenever a session is going to be destroyed
http://www.php.net/manual/en/function.s ... andler.php
Posted: Thu Jan 30, 2003 6:23 am
by chris12295
wouldnt that just be for sessions? how could i use this to delete .jpg, .gif, ... files?