469,898 Members | 1,687 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

Uploading images in MySQL DB using PHP Script

Hello,

How do I upload images under MySQL DB using PHP Script. Any Sample
script to upload and retrive images to MySQL DB would be appreciated.

Thanks

Rubal Jain
www.Rubal.Net
Jul 20 '05 #1
3 3534
"Rubal Jain" <ru*******@yahoo.com> wrote in message
news:7a*************************@posting.google.co m...
Hello,

How do I upload images under MySQL DB using PHP Script. Any Sample
script to upload and retrive images to MySQL DB would be appreciated.

Thanks

Rubal Jain
www.Rubal.Net


Use something like this if you want to store the image as a BLOB:

Store--
UPDATE tablename SET blobfieldname = LOAD_FILE('path:/to/image/image.jpg')
WHERE fieldid = $id LIMIT 1

Retrieve--
$myimg = mysql_fetch_array(mysql_query("SELECT blobfieldname FROM tablename
WHERE fielid = $id LIMIT 1"));

// $myimg[0] now holds your image. send approriate header and simply echo it
to display in browser

Norm

--
Avatar hosting at www.easyavatar.com
Jul 20 '05 #2
A Complete source would be appreciated..

Thanks
Jul 20 '05 #3
"Rubal Jain" <ru*******@yahoo.com> wrote in message
news:7a**************************@posting.google.c om...
A Complete source would be appreciated..

Thanks


I'm not sure what you need but I gave you the SQL queries to put an image
into the database and then get and display it. If you need a complete script
then you may need to learn quite a bit more.

--
Avatar hosting at www.easyavatar.com
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Srdjan Pejic | last post: by
11 posts views Thread by bissatch | last post: by
9 posts views Thread by C.Joseph Drayton | last post: by
1 post views Thread by ttamilvanan81 | last post: by
1 post views Thread by Waqarahmed | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.