MySQL Forums
Forum List  »  Newbie

Re: Multimedia and other Binary file storage
Posted by: Aldrin Albano
Date: August 17, 2004 03:55PM

An excerpt from MySQL/PHP Database Applications by Jay Greenspan and Brad Bulger:

"...even when you're using MySQL, there are times when you are better off using the filesystem for storage. Images (jpegs, gifs, pngs) are a perfect example. Even if your database supports binary data, there's little advantage in putting an image in a database. You need a database for storing and querying normalized data. In your database you are much better off storing the PATH to the image stored in your filesystem. That way it will be easy enough to fill in the src attribute in your <img> tag."

Upon further experiments both char(255) and varchar(255) is ideal for a img src path storage. Storing your images in your site's root folder, you would only use "./images/photo.jgp" as the path in the database. This works in both PHP and Coldfusion MX pages.

Thanks for the tip guys.

Aldrin Albano

Options: ReplyQuote

Written By
Re: Multimedia and other Binary file storage
August 17, 2004 03:55PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.