Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to display image in image control that saved in Local Drive D.Why are not display image that saved in Local Drive D in image control.What should I do.I want to show image in image control.Help me.Thanks for all.Please quickly answer me.
Posted

For most - and for good reasons - you have no access to disk outside of your web site's root folder. To enable access to local drives you will have to add access to the user runs your site. However, without good (very good) reason do not!!!
 
Share this answer
 
You need to convert image to byte array and then you can pass it in to data table and bind with control.

for converting image to byte array

C#
var file = File(imagePath, System.Net.Mime.MediaTypeNames.Image.Jpeg, "Image");
image = Bitmap.FromStream(file.InputStream);
MemoryStream stream = new MemoryStream();
image.Save(stream, format);


You can use stream Variable as you wish ....

C#
context.Response.BinaryWrite(stream.ToArray());



For More help you can search it in to google and see following links

http://www.nullskull.com/q/10361859/how-to-show-image-from-local-drive-d.aspx[^]

http://www.charith.gunasekara.web-sphere.co.uk/2010/09/how-to-show-selected-image-file-without.html[^]


With Regards,
Manoj
 
Share this answer
 

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