Re: Photo Album Schema

From: Date: Tue, 21 Aug 2001 17:04:23 +0000
Subject: Re: Photo Album Schema
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-11616@lists.php.net to get a copy of this message
on 8/21/01 9:58 AM, Sheridan Saint-Michel (webmaster@foxjet.com) 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: <webmaster@gseis.ucla.edu> | | UCLA -> GSE&IS -> ETU | W: <http://www.gseis.ucla.edu/> | +-------------------------+---------------------------------+

« previous php.db (#11616) next »