Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Showing Images

$
0
0

I am doing a web project that will allow users to upload images.  I am doing this by saving the images to the filesystem and saving the path and other info to a database.   To save the path I am using  

Path.combine(_hostingEnvironment.WebRootPath, "images", theusername, thefoldername)

   from the System.IO.Path class. 

If I save the images directly to the wwwroot/images folder they will display correctly in the View using <img src="@item.path" alt="alttext"/> in the html.(scaffolded using vs2015). However I would like them to be a little more organized than that by creating a subfolder for every user and then each user will be able to create any number of subfolders after that.  

The problem I am having is that when using subfolders to the images folder, the image is displaying a blank, all white image.  When running I have checked the html generated for the image src.  The path is correct and the alt text is not displaying.  What am I missing here?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>