gordon-matt / peachpie-responsive-file-manager

Responsive File Manager running on .NET Core with Peachpie
24 stars 16 forks source link

.net core 6 response file manager blank white error #25

Closed areltasarim closed 2 years ago

areltasarim commented 2 years ago

Hello

.net core 6 I am getting the attached error Could you help

Başlıksız-1

gordon-matt commented 2 years ago

That's strange. Do you have the latest version installed? If so, please create a small test project, upload it to GitHub and post the link here.

areltasarim commented 2 years ago

hello

https://github.com/areltasarim/WebApplication29

gordon-matt commented 2 years ago

Well, I had a quick look..

For one, you have a mismatch between versions of PeachPie.App (1.0.0-preview3) and PeachPie.AspNetCore.Web (1.0.18).

But why are you referencing the projects at all anyway?

You don't need the projects in your Library folder. Just use the NuGet package instead; it makes everything much simpler. Here: https://www.nuget.org/packages/ResponsiveFileManager.AspNetCore/

You don't need to reference PeachPie yourself then either.. so remove everything from your Library folder.. then remove the PeachPie NuGet packages, then add the ResponsiveFileManager.AspNetCore NuGet package.

The easiest thing is start a new, blank project and follow the instructions that I put in the README.md file: https://github.com/gordon-matt/peachpie-responsive-file-manager

areltasarim commented 2 years ago

Hello

I did what you said, but I still get the same error. You can review the project from this link.

https://github.com/areltasarim/ResponseFileManager

gordon-matt commented 2 years ago

No, you did not follow the instructions in the README... I see you're missing the settings in appsettings.json... and you are missing app.UseResponsiveFileManager();... and you will also need to follow the instructions about copying the plugin for TinyMCE. Please read the instructions before asking for help again.

gordon-matt commented 2 years ago

Also, use ResponsiveFileManager.AspNetCore NuGet package... not ResponsiveFileManager package

gordon-matt commented 2 years ago

And you can remove this:

var rfmOptions = new ResponsiveFileManagerOptions();
app.Configuration.GetSection("ResponsiveFileManagerOptions").Bind(rfmOptions);
gordon-matt commented 2 years ago

Okay I ran it sucessfully on your project. Just do this:

  1. Add this to your appsettings.json:
"ResponsiveFileManagerOptions": {
    // Path from base_url to base of upload folder. Use start and final /
    "UploadDirectory": "/Media/Uploads/",

    // Relative path from filemanager folder to upload folder. Use final /
    "CurrentPath": "../Media/Uploads/",

    // Relative path from filemanager folder to thumbs folder. Use final / and DO NOT put inside upload folder.
    "ThumbsBasePath": "../Media/Thumbs/",

    "MaxSizeUpload": 10
  }
  1. Remove package, ResponsiveFileManager and install package ResponsiveFileManager.AspNetCore

  2. Change your Program.cs to this:

using Microsoft.Extensions.FileProviders;
using System.Reflection;

var builder = WebApplication.CreateBuilder(args);

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

// Adds a default in-memory implementation of IDistributedCache.
builder.Services.AddDistributedMemoryCache();

builder.Services.AddSession(options =>
{
    options.IdleTimeout = TimeSpan.FromMinutes(30);
    options.Cookie.HttpOnly = true;
});

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();

app.UseAuthorization();

app.UseSession();

app.UseDefaultFiles();
app.UseStaticFiles(); // shortcut for HostEnvironment.WebRootFileProvider
app.UseStaticFiles(new StaticFileOptions
{
    RequestPath = new PathString("/filemanager"),
    FileProvider = new PhysicalFileProvider(Path.GetFullPath(Path.Combine(Assembly.GetEntryAssembly().Location, "../filemanager"))),
});

app.UseResponsiveFileManager();

app.UseRouting();

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

app.Run();
areltasarim commented 2 years ago

thanks a lot for your help it worked now