Hi,
I'm wondering how i can upload images into a database and display an uploaded image at the same time. For example when the upload button is clicked, the image is inserted into the database and displayed in the frame. (It doesn't matter whether the page reloads or not). I have studied several tutorials but all handle uploading and displaying images seperately. How can i achieve this? Thanks

Recommended Answers

DB storage of images is a bit messy. As Venter suggests - load to folder and store the path to the DB. You can then display the image via simple <img src="..." />

The blob alternative is sanitize... get contents... store... get image id and use to pass to img …

Jump to Post

All 2 Replies

Hii dhani09.. Your trying to diaplay the uploaded image file.so that move the file to the folder(images) display the image from that and save the image path in database...

Member Avatar

DB storage of images is a bit messy. As Venter suggests - load to folder and store the path to the DB. You can then display the image via simple <img src="..." />

The blob alternative is sanitize... get contents... store... get image id and use to pass to img src... echo output from DB data

Something like:

<img src="createimage.php?image_id=<?php echo $image_id; ?>

Yuk.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.