trannamtrung1st / elFinder.Net.Core

An elFinder backend connector with less magic code and more compatibility. This enables .NET Standard 2.0 projects to easily integrate elFinder functionalities.
Apache License 2.0
12 stars 8 forks source link

Download single file #3

Closed benny-adiwijaya closed 3 years ago

benny-adiwijaya commented 3 years ago

Hi,

Your new updated feature "zipdl" are awesome, but I think there is issue when download a single file.. there is a process that never ends even though download file is complete. Can you fix this? Thank you

Screen Shot 2021-06-17 at 6 05 36 PM
trannamtrung1st commented 3 years ago

Hi @benny-adiwijaya, it's me who updated the version of elFinder client to the latest one but did not implement the changelogs yet. I just released a new version that:

There are also some small changes in the example project, please take a look before updating to the new version. Nuget: https://www.nuget.org/packages/elFinder.Net.Core/

benny-adiwijaya commented 3 years ago

Hi @trannamtrung1st , thank you for your update, its work.. But now, I have new problem

In my project, I want to set the volume in SetupConnector in the controller because I have requirement the volume root and max upload size is depending on user who login

This is my code

private async Task SetupConnector(string userId) { var userFolders = await _userFolderRepository.FindByUser(userId); var driver = new FileSystemDriver(_pathParser, _pictureEditor); foreach (var uf in userFolders) { var userRootDir = _pathParser.Decode(uf.Folder.Path); var volume = new Volume1(driver, Startup.MapPath($"~/Files/{userRootDir}"), $"/Files/{userRootDir}/", $"/api/FileSystem/thumb/{userId}/") { StartDirectory = Startup.MapPath($"/Files/{userRootDir}/start"), Name = uf.Folder.Name, ThumbnailDirectory = PathHelper.GetFullPath("./wwwroot/Files/thumb"), IsReadOnly = uf.IsReadOnly, IsLocked = uf.IsLocked, IsShowOnly = uf.IsShowOnly, MaxUploadSize = (uf.Folder.Quota - uf.Folder.UsedSpace) }; _connector.AddVolume(volume); volume.Driver.AddVolume(volume); } }

Before update I can download file / folder, but now I cant download with excetion : Exception thrown: 'System.IO.FileNotFoundException' in elFinder.Net.Core.dll Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll

Is there any correct way to achieve my requirement? Thank you

trannamtrung1st commented 3 years ago

hi @benny-adiwijaya , can you provide more details about:

Btw, have you successfully run the demo yet?

benny-adiwijaya commented 3 years ago

hi @trannamtrung1st , it turned out that the problem is the authorization like I was facing before.. when download file elFinder client does not send the Authorization. So in my project, setupConnector not set a volume because user is null, thats why it thrown exception.. So, is it posible to using elfinder with web token authentication running without any problem, especially for download file? Right now I'm using the latest version 1.1.2 and I have successfully run the demo

benny-adiwijaya commented 3 years ago

I already found out the solution with JWT middleware and use cookies :)

trannamtrung1st commented 3 years ago

I already found out the solution with JWT middleware and use cookies :)

Glad that you found it out. I'm working on some new features with a new major release of the library, and it will include some examples for authorization and support for size restriction capability.