Skip to content

komarowski/MiniFileManager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini File Manager

MiniFileManager/FileManagerService.cs - file manager service. It adds minimal API endpoints that perform file management operations. At the specified path, it loads html with a javascript script that is responsible for the logic on the client side.

With this simple service structure, you can easily add new functionality and change the front-end part for your needs.

Demo

Usage

We need to register the service in the DI container and call its endpoint registration method from Program.cs:

var builder = WebApplication.CreateBuilder(args);
// Specify the file manager root directory and index URL page.
builder.Services.AddScoped(provider => new FileManagerService("wwwroot", new PathString("/filemanager")));
var app = builder.Build();

using (var scope = app.Services.CreateScope())
{
  var service = scope.ServiceProvider.GetService<FileManagerService>();
  service.RegisterFileManagerEndpoints(app);
}

app.Run();

You can also specify your own template for the html page of the file manager. An example - MiniFileManager/filemanager.html.

builder.Services.AddScoped(provider => new FileManagerService("wwwroot", new PathString("/filemanager"), "filemanager.html"));

About

Single-file ASP.NET Core file manager.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published