Page 1 of 1

What's the good way for file naming?

Posted: Tue Oct 16, 2007 5:12 am
by phpwalker
I want the script to auto generate a file name for the file just created, don't want the user to input the file name.

What is the best way to create the file name? I'm currently using today's date and time as the name of the file. But, when there's too many files created at the same time, I will get only one file name for several different content of files.

How do I generate the file name like the photobucket.com, or megaupload.com those sites? What are they using acftually? Random string? Any good article for this kind of techniques? :?:

I hope you guys understand what I'm talking about.

Posted: Tue Oct 16, 2007 5:13 am
by Kieran Huggins
I guess it depends on the content, I would try to name it something meaningful.

Posted: Tue Oct 16, 2007 5:15 am
by jmut
Can't you use random string...
and do random while (!file_exists($random_string))

Posted: Tue Oct 16, 2007 5:46 am
by phpwalker
Kieran Huggins wrote:I guess it depends on the content, I would try to name it something meaningful.
I know, just that I wanted to know if I use the date and time to name the file, at the end of the file name I add some random string to it, is it still consider meaningful?

Except random string, any others way?