I think this idea is an excellent one, if your going for 1 huge directory.
Store the original filename in the DB and the uniquely generated filename,
so that you know what file to load and can display a meaningful filename to
the viewer. Personally I'd go with seperate directories, but that's just
personal preference...
-----Original Message-----
From: Paul Burney [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 21, 2001 10:04 AM
To: php mailing list
Subject: Re: [PHP-DB] Photo Album Schema
on 8/21/01 9:58 AM, Sheridan Saint-Michel ([EMAIL PROTECTED]) wrote:
> If you are going to use a single directory with a filename
> convention I would suggest something simple, yet unique
> like
>
> "id" . "filename"
>
> Where id is the unique userid from the DB and filename
> is the original name of the file.
>
> This would avoid conflicts (which is the point of a naming convention)
> and be fairly easy to implement.
Be careful for bad characters in filenames. You should probably
preg_replace a few things in the filename first (&*/;). You may also need
to code something warning the user if they are about to overwrite a file
whose name already exists.
I usually just name a file based on the timestamp, i.e.,
$parts = explode(' ',microtime());
$parts[0] = substr($parts[0],2);
$file_name = $parts[1] . $parts[0] . $file_extension;
You should also look at using the GetImageSize function to determine whether
or not the file is really an image.
Good luck.
Sincerely,
Paul Burney
+-------------------------+---------------------------------+
| Paul Burney | P: 310.825.8365 |
| Webmaster && Programmer | E: <[EMAIL PROTECTED]> |
| UCLA -> GSE&IS -> ETU | W: <http://www.gseis.ucla.edu/> |
+-------------------------+---------------------------------+
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]