Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I uploaded an image on database. I saved only name of image on database and the path saved on appSettings like:

XML
<appSettings>
    
    <add key="ItemImagePath" value="C:\Users\USER\Downloads\Mvc4_FileUpload\Mvc4_FileUpload\Content\" />
  </appSettings>

the image is saved on the content folder of an program.

Now I want to show the images using the path like:
C#
ConfigurationManager.AppSettings["ItemImagePath"]+@Model.ImageName


I am showing the image by the code like:

C#
var imagePath = System.Configuration.ConfigurationManager.AppSettings["ItemImagePath"]+@Model.ImageName;
<img src=@imagePath alt="Sample Image" width="300px" />


But it shows that "could not load image"!!!

Would you please help me to do that.
Posted
Updated 12-Jul-14 18:41pm
v2
Comments
Kornfeld Eliyahu Peter 13-Jul-14 4:44am    
Does the actual value of imagePath point to an accessible image?
rayhan12345 13-Jul-14 4:55am    
Ya, I understood that. And I also soved it. Thanks!!!!!!!!!!
Kornfeld Eliyahu Peter 13-Jul-14 4:56am    
Good luck!

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