RE: Re[4]: asking comment

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

 



 
 
> Sure, at the base level the issue is simply the uniqueness of 
> the filename. So there are several options open in this 
> regard. Either use an md5'd uniqid rand combination (as on 
> the uniqid manual page) and just go with that, operating 
> under the assumption that the chances of a conflicting hash 
> are remote at best.
> Or another method (which the OP touched upon) would be using 
> some SQL space and simply getting the next available ID back 
> and using it as the filename. There are no race conditions 
> here, the ID you will get is unique to that session. Assuming 
> the site was correctly set-up you wouldn't then even need to 
> check the file exists, just move_uploaded_file on it. But for 
> the overly paranoid you could do and if a file does exist, 
> get another ID. While it involves DB overhead it ensures 
> relatively bullet-proof uniqueness and no warning generation 
> / suppression.

I'll take absolutely bullet-proof and handled/supressed warnings, over relatively bullet-proof.

Jared

-- 
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