0

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.

3
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by ReDuX
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.

0

You wouldnt normally store the actual image in the database, rather store/fetch its name from the database and include that in a html <img src="images/<?=$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 <img> 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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.