473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 3651
"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Srdjan Pejic | last post by:
Hello, I have a problem that I have not been able to solve, even after searching the web. I have stored couple of images in the MySQL database and I am trying to get them displayed on a web page...
3
by: Rubal Jain | last post by:
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
11
by: bissatch | last post by:
Hi, I am trying to upload an image, create a new file based on that image and then store the base64 encoded image data in a database. I dont really know where my code is going wrong so I will...
9
by: C.Joseph Drayton | last post by:
Hi All, I have a web site I am developing, and have a question. I would like members to be able to upload pictures. Do you think they should be saved as individual files or should they be put...
5
tolkienarda
by: tolkienarda | last post by:
hi all i need to allow people to upload images to my site and then save them in a mysql database. i've looked at some prebuilt scripts using iframes but i don't think that will work for me. I want...
1
by: ttamilvanan81 | last post by:
Hai everyone, I need to provide the slideshow for the images. I have upload the images into database. Then i will retrive all the images from the database and provide the slideshow for those...
1
by: thulaseeram | last post by:
I am using iframe to store uploaded images, it is uploading fine in IE but it is not happening in firefox means first time it is uploading image if i try to upload second image it is not calling even...
14
w33nie
by: w33nie | last post by:
What I'm trying to do here, is upload a video to the ../video/ folder, and up to 5 images to the ../images/ folder. As well as the database information like title, content and each file's file...
221
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
7
by: nwclark | last post by:
Ok... I have a noobie issue. I am trying to upload a photo to specific directory on my server. (this is working correctly with the code below). However, I am also trying to rename the file and...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.