Saving Image in MYSQL

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
winsonlee
Forum Commoner
Posts: 76
Joined: Thu Dec 11, 2003 8:49 pm

Saving Image in MYSQL

Post by winsonlee »

Is there anyway i can save the image in a mysql database ??? Or i can only store it in a folder ??? I know i am able to do it with ms access. But i am not sure if mysql can do the same thing. If it can be done, can you kindly provide me a short explanation and code on how this can be done ??
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

It can vary by need, but generally it is suggested that you store the image in a folder as normal and only store the path to the image in the database. It is possible to store the image itself in MySQL but it is not usually done that way.

Mac
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

If you really wanna store your images in the db, then here's the tutorial I first learned from:

http://www.phpbuilder.com/columns/florian19991014.php3
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

Interesting article. I have to admit, I never knew this was even possible. :)
microthick
Forum Regular
Posts: 543
Joined: Wed Sep 24, 2003 2:15 pm
Location: Vancouver, BC

Post by microthick »

Storing images in a db is usually only used when you have multiple web servers or file servers, I think.

Like, Friendster for instance might use a db to hold their images, but I'm not sure they do.
Post Reply