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]

Reply via email to