YG.ASPNetCore.FileManager 9.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package YG.ASPNetCore.FileManager --version 9.0.2                
NuGet\Install-Package YG.ASPNetCore.FileManager -Version 9.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="YG.ASPNetCore.FileManager" Version="9.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add YG.ASPNetCore.FileManager --version 9.0.2                
#r "nuget: YG.ASPNetCore.FileManager, 9.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install YG.ASPNetCore.FileManager as a Cake Addin
#addin nuget:?package=YG.ASPNetCore.FileManager&version=9.0.2

// Install YG.ASPNetCore.FileManager as a Cake Tool
#tool nuget:?package=YG.ASPNetCore.FileManager&version=9.0.2                

YG.ASPNetCore.FileManager (Free & Open Source File Explorer for ASP.Net Core 6+)

YG.ASPNetCore.FileManager is an "enhanced" fork of HGO.ASPNetCore.FileManager free, open source, feature rich and easy to use file explorer/manager component for ASP.Net Core 6 and above with MIT license!

NuGet version (YG.ASPNetCore.FileManager) NuGet Downloads

Online Demo

<img alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">

YG.ASPNetCore.FileManager

Features:

  • File Encryption (The primary goal of encryption is to protect your files in the event of a data breach, whether caused by a vulnerability in the hosting provider or by direct file access attempts.)
  • Multiple Language Support with fully customizable language option
  • Enum Member Access for type safety
  • Manage server's files from client side
  • IMPROVED Copy & cut & paste functionality
  • Compress & extract archive files (Rar, Zip, Tar, Tar.GZip, Tar.BZip2, Tar.LZip, Tar.XZ, GZip, 7Zip)
  • Download & upload
  • Rename & delete files/folders
  • Edit text based files with full feature code editor (CodeMirror) (e.g.: .css, .html, .js, ...)
  • Create new file/folder
  • Cross platform (Compatible with Windows & Linux & macOS file system)
  • Search
  • Ability to enable/disable features
  • Ability to control disk space usage
  • and more ...

YG.ASPNetCore.FileManager Light Mode YG.ASPNetCore.FileManager Dark Mode

How to Install:

At first you should install YG.ASPNetCore.FileManager from NuGet:

Install-Package YG.ASPNetCore.FileManager

Or via the .NET Core command line interface:

dotnet add package YG.ASPNetCore.FileManager

Either commands, from Package Manager Console or .NET Core CLI, will download and install YG.ASPNetCore.FileManager and all required dependencies. Now you need to add YG.ASPNetCore.FileManager to the ASP.NET Core services container. Open Program.cs and insert the marked lines into Program.cs file:

using YG.ASPNetCore.FileManager;

var builder = WebApplication.CreateBuilder(args);

// Add services to the container.
builder.Services.AddControllersWithViews();

// YG.AspNetCore.FileManager -------
builder.Services.AddHgoFileManager();
//-----------------------------------

var app = builder.Build();

// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
    app.UseExceptionHandler("/Home/Error");
    // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
    app.UseHsts();
}

app.UseHttpsRedirection();
app.UseStaticFiles();

// YG.AspNetCore.FileManager -------
app.UseHgoFileManager();
//-----------------------------------

app.UseRouting();

app.UseAuthorization();

app.MapControllerRoute(
    name: "default",
    pattern: "{controller=Home}/{action=Index}/{id?}");

app.Run();

Now you need to create an Action Method to handle server side operations, so open (or create) a Controller class and add the following action method:

[HttpPost, HttpGet]
public async Task<IActionResult> HgoApi(string id, Command command, string parameters, IFormFile file)
{
    return await _processor.ProcessCommandAsync(id, command, parameters, file);
}

Also you need to inject IFileManagerCommandsProcessor to you controller contractor method with IoC, so edit your controller contractor method like below:

private readonly IFileManagerCommandsProcessor _processor;

public HomeController(IFileManagerCommandsProcessor processor)
{
    _processor = processor;
}

Now you can add YG.ASPNetCore.FileManager component view to any razor page or view you want:

<div style="height: 550px; margin-bottom:20px">
        @await Component.InvokeAsync("FileManagerComponent", new FileManagerModel(){
            Id = "FM1",
            RootFolder = "files",
            ApiEndPoint = Url.Action("HgoApi"),
            Config = new FileManagerConfig(){
                UseEncryption = true,
                EncryptionKey = "<Your Super Secret Encryption Key>",
                DisabledFunctions = { Command.Delete, Command.Rename },
                Language = new TurkishLanguage(),                
            }
        })
</div>

Also you need to reference YG.ASPNetCore.FileManager JavaScript and CSS files to your view:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    
    @*YG.AspNetCore.FileManager Styles*@
    @this.RenderHgoFileManagerCss(true)
    @*---------------------------------*@
</head>
<body>
    <div class="container">
        <main role="main" class="pb-3">
        @await Component.InvokeAsync("FileManagerComponent", new FileManagerModel(){
            Id = "FM1",
            RootFolder = "files",
            ApiEndPoint = Url.Action("HgoApi"),
            Config = new FileManagerConfig(){
                UseEncryption = true,
                EncryptionKey = "<Your Super Secret Encryption Key>",
                DisabledFunctions = { Command.Delete, Command.Rename },
                Language = new TurkishLanguage(),                
            }
        })
        </main>
    </div>

    @*YG.AspNetCore.FileManager depends on jQuery, so you need to add jQuery reference before (If you don't it will automatically add jquery in newer versions) *@
    <script src="~/lib/jquery/dist/jquery.min.js"></script>
    
    @*----------------------------------*@

    @*YG.AspNetCore.FileManager Scripts*@
    @this.RenderHgoFileManagerJavaScripts()
    @*----------------------------------*@
</body>
</html>

For more information please check the following sample projects:

Note:

YG.ASPNetCore.FileManager depends on jQuery library, so you need reference jQuery library before calling RenderHgoFileManagerJavaScripts() (If you don't it will automatically add jquery in newer versions)

Third-party JS libraries which I used in this project:

Thanks to all!

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.3 0 11/21/2024
9.0.2 2 11/21/2024
9.0.1 2 11/21/2024
8.0.2 3 11/21/2024
7.0.1 5 11/21/2024
6.0.1 14 11/21/2024
0.0.0 17 11/21/2024

-package cleanup