Re: when to delete a temporary file ?

From: Date: Sat, 07 Jul 2001 17:07:20 +0000
Subject: Re: when to delete a temporary file ?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-56649@lists.php.net to get a copy of this message
"Lasse" <lm@nospam.dk> wrote in message news:20010706224839.48458.qmail@pb1.pair.com... > > "Arash Dejkam" <arashdejkam@yahoo.com> wrote in message > news:20010706075234.46906.qmail@pb1.pair.com... > > Hi, > > > > I've created a site where users can upload photos and specify which other > > users are allowed to view them using PHP session management. now I have > > alittle problem in the post-upload page, script creates a temporary copy > of > > the uploaded image with a name the same as user's session ID, and puts a > > <img src="temp file..."> in the page for the user to view the uploaded > photo > > and confirm it. now I don't know when to delete that temporary file ! > > because I don't know how long does the user's browser take to download the > > image. currently I delete it in the script coming up just after user > clicks > > the confirm button, but what if the user close his/her browser before > > clicking the confirm button ? the file remains there for ever !! > > what's your suggestion ? > > Don't your sessions time out BTW? That should make it possible to check for > any temp files whose session isn't alive anymore and delete them. Since the > corresponding session is dead anyway the image can be safely deleted... > > Or am I missing something? > > -- > Lasse > this was the first approach I thought about, but I don't know how to check session IDs other that current one I use session_is_registered() to check for the current session but how can I check for other sessions ? tell me please :) Thanks Arash Dejkam

« previous php.general (#56649) next »