You are here: RE: Re[4]: [PHP] asking comment « PHP « IT news, forums, messages
RE: Re[4]: [PHP] asking comment

Posted by Jared Williams on 03/30/05 21:02

> 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация