Reputation: 495
I am using MVC. i need to upload the image and display it in same page. i have uploaded the image and store the image in local folder. how to display the images from local folder file using mvc
Upvotes: 0
Views: 2746
Reputation: 46008
The best way is to create an action that will load the file from the folder and return it.
Use FileContentResult
:
public FileContentResult Display(string filename) {
byte[] byteArray = GetImageFromDisk(filename);
return new FileContentResult(byteArray, "image/jpeg");
}
The above is a very simplistic sample to get you going.
Upvotes: 2