Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

How to call HTML image path in c# code behind and save into the database using c# asp.net?
I don't want to take asp-image tag in my web application.
I have html image tag and i want to save image into the sql server database using c# asp.net.

Please help me.

How, it can be possible?

Thanks in Advance.

Ankit Agarwal
Website Application Developer
Posted
Updated 15-Jan-14 19:58pm
v2

For saving an image into DB, you need to convert it to byte format.

Then store the byte array in DB, and while retrieving the value again you need to convert the byte[] to image.
 
Share this answer
 
I suggest you save the address of the image to the database so that it wont consume much resources :)
 
Share this answer
 
Comments
[no name] 16-Jan-14 1:56am    
yes i want to save path of images, but how can we call html image tag in code behind c#?
Goenitz 16-Jan-14 2:40am    
hmm can you store the image in a panel?
[no name] 16-Jan-14 2:41am    
yes
Goenitz 16-Jan-14 2:47am    
or maybe you could use the image tool in the toolbox just set this on the code behind
when loading or when you want it
Image1.ImageUrl = (the path that comes from the database)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900