What's the good way for file naming?

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

What's the good way for file naming?

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post by Kieran Huggins »

I guess it depends on the content, I would try to name it something meaningful.
jmut
Forum Regular
Posts: 945
Joined: Tue Jul 05, 2005 3:54 am
Location: Sofia, Bulgaria
Contact:

Post by jmut »

Can't you use random string...
and do random while (!file_exists($random_string))
phpwalker
Forum Commoner
Posts: 81
Joined: Sun Apr 23, 2006 12:18 pm

Post 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?
Post Reply