File Manager not working

VS 2022    NetCore 6     Syncfusion V 20.2.0.38   Blazor Server App

On the attached project,  that I copied from this link here ,  the target directory is  "wwwroot\\Files\\NewFolder"  but it throw an exception on PhisicalFileProvider.cs 

NOTE: If I set the target directory to  "wwwroot\\Files" and remove the subfolder "NewFolder" it builds up and there is no exception, but if I add a picture inside the folder or create another subfolder then the exception happens again.

IMPORTANT NOTE: This is only happening on a project created with Net Core 6.  On a previous project that still has the Startup.cs the FileManager runs perfectly inside the same solution and using NetCore 6 and Syncfusion V. 20.2

I would like to see if there is a sample for the enviroment I am using. I searched almost the entire web (Yeah, one full day) but the closest I get was this link here that, unless I am missing something,  does not provide a  functioning working sample.




Attachment: RPTest_47ccbeae.zip

1 Reply 1 reply marked as answer

SS Sivakumar ShunmugaSundaram Syncfusion Team July 21, 2022 01:06 PM UTC

Hi Ben,


Greetings from Syncfusion support.


We checked the reported issue with the shared sample, and we understand that you are facing an issue while setting the root path in the FileManager physical service provider. As per the shared sample, the reported issue occurs due to the incorrect RootFolder path being set in the service provider. To overcome the issue, we have set the RootFolder path based on the below conditions in the shared sample. We have attached the modified sample to your reference.


Refer to the below code snippet.

[FileManagerController.cs]

 

        public FileManagerController(Microsoft.AspNetCore.Hosting.IHostingEnvironment hostingEnvironment)

        {

            this.basePath = hostingEnvironment.ContentRootPath;

            this.operation = new PhysicalFileProvider();

 

            if (this.basePath.EndsWith("\\"))

                this.operation.RootFolder(this.basePath + this.root);

            else

                this.operation.RootFolder(this.basePath + "\\" + this.root);

        }


Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/RPTest1960910157.zip


Please check the sample and get back to us, if you need any further assistance.


Regards,

Sivakumar S


Marked as answer
Loader.
Up arrow icon