Blazor .NET 8 file manager files in SQL database

How to store File Manager files in SQL database
Right now, they go to Azure.

<SfFileManager TValue="FileManagerDirectoryContent" ShowThumbnail="true" AllowDragAndDrop="true" AllowMultiSelection="true">

    <FileManagerAjaxSettings Url="https://ej2-azure-aspcore-service.azurewebsites.net/api/AzureFileManager/AzureFileoperations"

                             UploadUrl="https://ej2-azure-aspcore-service.azurewebsites.net/api/AzureFileManager/AzureUpload"

                             DownloadUrl="https://ej2-azure-aspcore-service.azurewebsites.net/api/AzureFileManager/AzureDownload"

                             GetImageUrl="https://ej2-azure-aspcore-service.azurewebsites.net/api/AzureFileManager/AzureGetImage">

    </FileManagerAjaxSettings>

</SfFileManager>

Running File Manager on Blazor Server.

Edward


3 Replies

JA Jafar Ali Shahulhameed Syncfusion Team March 27, 2024 08:44 AM UTC

Hi Edward,


Based on the shared details we can understand that you are trying to utilize Syncfusion File Manager component with SQL file provider. We have prepared the sample aligning with your requirements. Kindly refer the code changes below,


<SfFileManager TValue="FileManagerDirectoryContent">

    <FileManagerAjaxSettings Url=http://localhost:62869/api/SQLProvider/SQLFileOperations

                                UploadUrl=http://localhost:62869/api/SQLProvider/SQLUpload

                                DownloadUrl=http://localhost:62869/api/SQLProvider/SQLDownload

                                GetImageUrl=http://localhost:62869/api/SQLProvider/SQLGetImage>

    </FileManagerAjaxSettings>

</SfFileManager>


We have attached the sample for your reference,


Sample: Attached as zip file.


File Provider: https://blazor.syncfusion.com/documentation/file-manager/file-system-provider#sql-database-file-system-provider


It is important to note that you have to clone and run the SQL service sample to work on the shared File Manager sample. After running the project, it will be hosted in

http://localhost:{port}

and just mapping the ajaxSettings property of the FileManager component to the appropriate controller methods allows to manage the files in the SQL provider.


Kindly check out the shared details and get back to us if you need further assistance.


Regards,

Jafar


Attachment: FileManagerSQL_78d807d2.zip


EA Edward A Meijer March 27, 2024 06:27 PM UTC

Blazor .NET 8 How to store File Manager files in SQL database.
Thanks for the information I received so far.

But I, failed to mention that my SQL 2022 Enterprise instance is running on its own stand-alone server.
It is not local, My Visual Sudio 2022 Enterprise is also on its own server, including my IIS Server.
All servers are behind a Netgate 8200 router.

Here is a copy of my appsettings.json file:

"ConnectionStrings": {

   "FileManagerConnection": "Data Source=SQL1\\KXPN1;Initial Catalog=FileManager;Integrated Security=True;Multiple Active Result Sets=True;Encrypt=False;Trust Server Certificate=True"

IJSRuntime JsRuntime;

SfFileManager TValue="FileManagerDirectoryContent" ShowThumbnail="true" AllowDragAndDrop="true" AllowMultiSelection="true">

        <FileManagerAjaxSettings Url=http://sql.xpn.net:80/FileManager/SQLFileOperations

                                 UploadUrl=http://sql.xpn.net:80/FileManager/SQLUpload

                                 DownloadUrl=http://sql.xpn.net:80/FileManager/SQLDownload

                                 GetImageUrl=http://sql.xpn.net:80/FileManager/SQLGetImage>

        </FileManagerAjaxSettings>

    </SfFileManager>

Obviously, this is incorrect.

Thanks so much for the response, I did not think anyone would respond.
Truly amazing
Edward






JA Jafar Ali Shahulhameed Syncfusion Team April 2, 2024 06:14 AM UTC

Hi Edward,


We can understand that you are facing an issue while using the SQL provider. On validating your provided details, we suspect that the issue you are facing might be due to the below cases. We kindly suggest you refer to the below.


  1. Kindly check whether the url “http://sql.xpn.net:80/FileManager/SQLFileOperations” given is working properly. You can check that by simply pasting the url in your browser or by using the Postman application, it is receiving the proper response.
  2. If the above url is not working, then we kindly suggest that you check whether you have used the correct ”connectionName”, “tableName”, “rootFolderID” on your end. If not, you can modify the above according to your data source. For reference, refer to the service link provider below.


Service: https://github.com/SyncfusionExamples/sql-server-database-aspcore-file-provider/blob/master/Controllers/SQLProviderController.cs#L24


Kindly check out the shared details and get back to us if you need further assistance.


Regards,

Jafar


Loader.
Up arrow icon