Re: Storing images in MySQL table

From: Date: Thu, 20 Feb 2003 20:39:49 +0000
Subject: Re: Storing images in MySQL table
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-25806@lists.php.net to get a copy of this message
> The only disadvantage i've had of storing images in DB instead of > Filesystem, is that when you use a PHP script to output the image to a > client browser, MSIE doesn't always accept a suggested filename so it > might try and save it as "your-script.php?img=2". > > Other then that, keeping images in DB is a lot easier since you don't > have to keep your DB in sync with Filesystems ie. Deleted records in DB, > but images still exist. A way I've gotten around this, is that when I dump images into a directory for use by articles in my db, the filename is always name $articleid.filename (since articles and pics are uploaded to the server via php, this is easy to enforce). Thus, when I do kill of articles and what not, I simply remove $articleid.* from my images directory as well. I would strongly argue against stuffing images into a database tho. That's what filesystems are for, and they are way better at it. The overhead alone is reason enough to make you decide against it. -- At no time is freedom of speech more precious than when a man hits his thumb with a hammer. -- Marshall Lumsden Sumbry][ <sumbry@sumbry.com>

« previous php.db (#25806) next »