Copy files on disk

Hi all

I don't know if this is related to File Manager or I need another component to achieve this.

I need to do a simple file copy from one folder to another (and probably also create the target folder)

If this is to be performed on the server's file system or the client's file system doesn't matter - the operation is to be performed on a mapped drive or through a url which is reachable from the server and from the client using the logged on user's credentials

The task at hand is the following: A project contains a number of documents (i have a list in the SQL database) and for each document I need to copy from one project to another (i.e. from one folder to another)

is this possible using the Syncfusion components, and if yes - which components to use, and please deliver a sample.

I am using Blazor WASM

Kindly,



6 Replies

PM Prasanth Madhaiyan Syncfusion Team February 28, 2025 05:45 AM UTC

Hi Peter Rasmussen

 

Greetings from Syncfusion support.

 

Based on the details you shared, we understand that you have data stored in an SQL database and want to use that data to perform file operations, such as moving files from one folder to another, on your system. To fulfill this requirement, our Blazor FileManager seamlessly integrates with an SQL provider to ensure smooth and efficient functionality. 

 

To learn more about the SQL provider configuration, kindly refer to the link below:

 

 

After configuring it, simply build and run the SQL provider project. Once the project is hosted at http://localhost:{port}, map the ajaxSettings property of the FileManager component to the appropriate controller methods to manage files in the SQL database table.

 

[Home.razor]

 

@using Syncfusion.Blazor.FileManager

<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>

 

For your reference, we have attached a sample project and SQL service provider.

 

Sample: Attached as a zip file.

 

 

Please find the demo and documentation links for the FileManager component:

 

Demo: https://blazor.syncfusion.com/demos/file-manager/overview?theme=fluent2

 

Documentation: https://blazor.syncfusion.com/documentation/file-manager/getting-started-with-wasm-app

 

Check out the shared details and let us know if you need any further assistance.

 

Regards,

Prasanth Madhaiyan.


Attachment: BlazorWASMSample_e9a2d674.zip



PR Peter Rasmussen February 28, 2025 08:23 AM UTC

Hi Prasanth


Thank you for the sample. This works fine - as intended I guess - showing the file manager

It does however display an error message when opening:

Image_5011_1740730832162


But this is not what I am looking for.

I simply need to copy files on the file system

For example:

Copy a file from  x:\Documents\Project1\worddoc1.docx to  x:\Documents\Project2\worddoc1.docx

or from \\fileserver\documents\Project1\worddoc1.docx to \\fileserver\documents\Project2\worddoc1.docx

Both locations will be available from the client or from the server, so the code can be in my server project or in the client project (I am using WASM)


Kindly,

Peter



PR Peter Rasmussen February 28, 2025 08:25 AM UTC

To clarify: I need to do this programmatically, not from a user interface presented to the user.




PM Prasanth Madhaiyan Syncfusion Team March 3, 2025 05:58 AM UTC

Hi Peter Rasmussen,


Based on the shared details, when running the Blazor WASM FileManager sample, it shows a dialog popup with a "Failed to fetch" error message because the SQL service provider is not running on your end. So, we suggest you run the SQL service provider first on your end and then run the Blazor WASM FileManager. This will load the files properly in the FileManager based on the SQL data we have provided. Once loaded, you can perform file operations in the FileManager component as needed.


Try out the shared details and let us know if you need any further assistance.


Regards,

Prasanth Madhaiyan.



PR Peter Rasmussen March 3, 2025 09:33 AM UTC

Hi Prasanth,

Okay - so basically - the way I understand this - the SQL Service Provider is a (web?) service which runs in the background on my backend and the file manager connects to it to perform file operations on the server.


Basically - SQL service provider file operations may not be what I need - All I need to do is to programmatically perform some file copy operations - the reason why SQL came into focus here is that I mentioned that I have a file list coming from SQL.

I.e. to take it from the bottom:

- I have one "project" in my solution, which has a number of files (word documents) associated

- I need to run through the list of files from one project and copy the files to another project

- file \\fileserver\projectdocs\project1\file1 to be copied to \\fileserver\projectdocs\project2\file1
- file \\fileserver\projectdocs\project1\file2 to be copied to \\fileserver\projectdocs\project2\file2
etc...


I do not need the file manager UI, but I only need to do the file copy operations progammatically from my solution

Peter




PM Prasanth Madhaiyan Syncfusion Team March 4, 2025 06:27 AM UTC

Hi Peter Rasmussen,


Based on the shared details, we would like to inform you that the Blazor FileManager component is a UI-based component. When performing file operations (cut, copy, paste, delete, download, rename, etc.) in the FileManager component UI, the corresponding actions are handled on the server side. This is the default behavior of the Blazor FileManager component. Without the FileManager component, file operations cannot be performed on the server side alone.

Please review the shared details and let us know if you need any further assistance.

Regards,

Prasanth Madhaiyan.


Loader.
Up arrow icon