Hi I'm stuck for an hour to fix the image retrieving from "D:\Sample" path. I'm retrieving the correct path but not displaying because of localhost:port "(mylocalhosthere):(port)/D:/Sample/sample1.jpg" . How can I display the image outside of my project path? Anyone help me. Thank you. Here's my code:
Controller:
public class UploadController : Controller
{
//
// GET: /Upload/
public ActionResult Index()
{
const string root = @"D:\Sample";
var all = Directory.GetFiles(root).Select(Path.GetFullPath).ToArray();
return View(all);
}
}
}
View:
@{
ViewBag.Title = "Index";
}
@model string[]
@foreach(var image in Model)
{
var aaa = System.IO.Path.GetFileNameWithoutExtension(image);
<img src="@Url.Content(image)" alt='@aaa'/>
<input type="checkbox" id= '@aaa' />
}