Reputation: 91
HTML
<h3>Single Upload</h3>
<form method="post" enctype="multipart/form-data">
File <input type="file" name="file" />
<br />
<input type="button" value="Upload" onclick="return SaveExit()" />
</form>
<img src="C:/Users/Gigabyte/source/repos/ReimbursementSystem/ReimbursementSystemAPI/wwwroot/Images/biomimikrifix1.png" width="100" height="200" alt="3" />
I want to simply show the image from the other project with the path but it doesn't work. is there a way to simply show it from another project?
Upvotes: 0
Views: 820
Reputation: 48
In ASP.Net Core MVC you are not allowed to load local resource file rather than wwwroot/images folder by default. But if you want to use a different location then you can simply add this middleware to your startup.cs
app.UseStaticFiles();
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(
Path.Combine(@"C:\Users\Gigabyte\source\repos\ReimbursementSystem\ReimbursementSystemAPI\wwwroot", "images")),
RequestPath = "/images"
});
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3"/>
Hope this will solve your issue.
Upvotes: 1
Reputation: 9993
You can use this code
<img src="/Images/biomimikrifix1.png" width="100" height="200" alt="3" class="detailImage" />
Upvotes: 0