How we can show image from database to our web form

Questions by nidhi.amulya

Showing Answers 1 - 6 of 6 Answers


  • Jun 2nd, 2008

Create a folder in the application directory. Store the images in that folder. At the same time store the Image path in the database. when u r retriving the images just take image control and assign the image path from the database. u have input type = file in html right. using that we can upload and save in to the database. Hope u will get an idea.


  • Jul 9th, 2008

use ascx control, so that the image stored in DB can be retrieved easily, even in which format it will be.....

  Was this answer useful?  Yes


  • Aug 11th, 2008

You need to create one folder in your application named Images and store all the images in this folder. Now in your table add one column named Image_Url and save the path of each image. now in your .aspx page take one Image control and in the ImageUrl property bind the column. For example


  • Mar 2nd, 2009

What I understand from your question is that, you have the image content in your data base and wants to read it from there and show it to web page.

If I am right in my perception, then a simple solution would be as follows.

Setup a virtual directory and give it necessary write permission for (Network Service if u r using unauthorized access. otherwise for the user under which you application runs in windows authentication mode).

Read the image content from the database into a byte array (byte[]). Now create a filestream object with a new filename targeting the early mentioned folder. Now write your array to the stream. Flush the stream and dispose it. Now you can easily build relative/absolute url for that file and bind it to your image control in your page.

  Was this answer useful?  Yes


  • Jun 18th, 2010

All the answers are refering to storing the file in a physical file system. but, we do have the Blog and CBlog datatypes to store the binary informaiton into the DB and retrieve the same and use them.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions