Re: Logic sought

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux