Re: Logic sought

From: Date: Thu, 10 Jul 2008 06:36:50 +0000
Subject: Re: Logic sought
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-276560@lists.php.net to get a copy of this message
tedd wrote: > If two, or more, users hit the site at the same time then a RACE > condition may have one user getting something they didn't ask for or > not getting anything at all. > > The complicated way I figure I could solve this would be to: > > 1. Generate a random string name for the file -- instead of test.zip, > it could be ax12nhg34.zip. Either a random name or one based on the session_id(). > I know this will work, but if the user never downloads the file, then > the files accumulate on the server. Use cron to run a daily job of 'find /yourtempdir -type f -ctime +1 | xargs rm' Run more often and/or with less ctime if you need the space or the site is very busy. /Per Jessen, Zürich

« previous php.general (#276560) next »