Page 1 of 1

Images in databases

Posted: Fri Nov 02, 2007 5:00 am
by Jdavis
Hello, I fear im going to ask the simplist question ever posted, however it hav been haunting me for ages now.

I have a database which people can add their details to, but now i want to be able to upload an image to the database and have it recalled when a search is performed.

Regards,
James

Posted: Fri Nov 02, 2007 6:17 am
by Oren
Did you try to search first?
Anyway, I'll save you the effort:

1. Images go to the file system in the usual way (upload them normally like any other file).
2. Store in the database the path to the image.

Posted: Fri Nov 02, 2007 8:54 am
by impulse()
There is the method of storing the images as BLOB data but I've been advised no end this isn't a good way to treat your MySQL server.

Posted: Fri Nov 02, 2007 10:34 am
by louie35
I found Oren's option to be the best.

Posted: Sat Nov 03, 2007 9:30 am
by markusn00b
Agreed, saving the uploaded images in a new directory and then saving the path to the image in the DB is the best way about it :)