Click here to Skip to main content
16,016,580 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have saved images in a path and pass the Name(GUID) to sql database using mvc5, when i query for load data again, i can get the name of image, how to get image from location by this name

Thank You !

What I have tried:

just only read image name from database ,
Posted
Updated 23-Nov-16 23:20pm
Comments
F-ES Sitecore 24-Nov-16 4:21am    
If the image is saved to the webspace then just construct a url to the image using the name retrieved from the database;

<img src="@Url.Content("~/images/yourimage.png")"></img>

only the path will have your chosen filename in it.

1 solution

Hello,

If you save your file on client server path. Then use the below code:

var fileName = "Get file name from DB with extension".

C#
var pathFile = Path.Combine(System.Web.Hosting.HostingEnvironment.MapPath("~/Images/"), fileName);


Thanks
Ajay
 
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