0

I'm building a small app and want to access files (images) from a directory outside the project but on the same server the app will be running.

How can I access the directory I want?

mapa0402
  • 454
  • 1
  • 8
  • 24

1 Answers1

0

I used this in Startup.cs inside Configure:

app.UseFileServer(new FileServerOptions()
{
    FileProvider = new PhysicalFileProvider(env.ContentRootPath + "/Albums"),
    RequestPath = new PathString("/Albums"),
    EnableDirectoryBrowsing = true
});

And from Model that should be using it:

Initialize(_environment.WebRootPath + "/Albums");
mapa0402
  • 454
  • 1
  • 8
  • 24