954,170 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

uploading image in database

I am new to PHP and don't know how to upload a picture in database and after uploading how to display it.

Plz help me if u know.

sunil kumar bob
Newbie Poster
1 post since Oct 2004
Reputation Points: 10
Solved Threads: 0
 

Storing a picture in a database is generally a bad idea... they are usually designed for fast retrieval operations of small bits of data, not saving massive picture files.

Roberdin
Supreme Evil Overlord
Team Colleague
282 posts since Feb 2003
Reputation Points: 63
Solved Threads: 6
 

You wouldnt normally store the actual image in the database, rather store/fetch its name from the database and include that in a html <?=$image_name_here?> tag.. In this example you would store your images on the server in the /images/ folder. And call the name of the image to be placed in the tag from the database.

Also there is the performance issue. Doing the above is fast and simple and exactly what SQL is intended for. Storing large image files like 100kb for example will decrease the performance of the specified task by 500% or more (guessing). Taking 0.5 seconds rather than 0.005... I'm sure you'll agree this can mount up with more concurrent users visit the page and request images from a database bloated with BLOB data.
Sorry, I'm going on a bit arent I. time to shut up ReDuX.

ReDuX
Junior Poster
127 posts since Sep 2004
Reputation Points: 12
Solved Threads: 5
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You