If uniqueness is an issue,
http://us2.php.net/manual/en/function.md5-file.php may be good in
conjunction with a sanitized file name.
For one site with public uploads, I use [sanitized and shortened file
name]-[md5 of file].[ext], which ensures duplicate files will overwrite
each other but otherwise you don't have to really worry about the file
names being unique.
Using [md5 of file].[ext] only means much less helpful file names when
downloaded and a much larger (but still small) chance of collisions.
- Ken Winters
Stewart Robinson wrote:
I believe the problem Nitin had was around long file names
and that approach doesn't guarantee a file name that is within a
certain length, where as the md5 does. I agree that his approach using
those two lines is a nicer cleaner approach if you don't have to worry
about file name length.