I have an ImageUpload folder in the root of my ASP.NET MVC website, running on Windows and hosted on AWS.
When displaying the images, I need something like this:
<img src="/ImageUpload/MyImage.jpg" alt="">
When uploading images, I need a physical path...
string fullPath = System.IO.Path.Combine("C:\\MyWebsiteRoot\\ImageUpload", MyImage.jpg);
file.SaveAs(fullPath);
I want to put the path in my web.Config:
<!-- if I use a url path, the save won't work -->
<add key="ImageUploadPath" value="/ImageUpload"></add>
<!-- if I use physical path, the display won't work -->
<add key="ImageUploadPath" value="C:\\MyWebsiteRoot\\ImageUpload"></add>
Is it possible to define ImageUpload path in the Web.Config in a manner that it can be used both as a physical path and url path? Or do I need to define 2 different variables in my Web.Config?