How can I store an image to the database's field ?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

How can I store an image to the database's field ?

Post by Mds »

Hi friend.
I want to store an image to the MySql database's filed?

I don't know how I can do it :?:

Can you help me ? :?
Last edited by Mds on Sat Jul 05, 2008 5:39 pm, edited 1 time in total.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Hw can I store an image to the database's field ?

Post by jaoudestudios »

Convert it to a base64 string - be warned it will be big!

Why not just have an upload directory?
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

Re: How can I store an image to the database's field ?

Post by Mds »

Why not just have an upload directory?
Is it better ?
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

Re: How can I store an image to the database's field ?

Post by Mds »

Convert it to a base64 string
OK, Do you have any code for encoding an image to the string and decoding it ?
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: How can I store an image to the database's field ?

Post by jaoudestudios »

Its more the norm to use an upload directory.

I have the code for the conversion somewhere, I will try and dig it out tomorrow.
User avatar
Mds
Forum Contributor
Posts: 110
Joined: Tue Apr 22, 2008 8:56 pm
Contact:

Re: How can I store an image to the database's field ?

Post by Mds »

I have the code for the conversion somewhere, I will try and dig it out tomorrow.
Thank you.
Post Reply