This is a migrated thread and some comments may be shown as answers.

Can FileManager Be Used to Manage Client Files?

1 Answer 43 Views
FileManager
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Veteran
Patrick asked on 09 Mar 2021, 09:28 PM

I have a use case in which I have the user uploading a file to a memory stream via Kendo Uploader. From there, information is extracted from the file and recorded in the database. 

What I'd like to be able to do is enable the user to use something like the FileManager to navigate to a folder either on their local hard drive or a UNC path to a network share and select each of the files to be processed. I would like to have each of the files in turn uploaded and processed as described in the first paragraph. I know I can accomplish that with the Uploader. However, what I'd also like to do subsequently is after the file is processed, move the process file from the local drive folder or network share to a folder within the source folder as a way of letting the user know the file has been processed and should not be selected again.

Can I 1) act on selected local/client-side files, 2) move client-side files to a location w/in the client-side directory? If so, can you provide an example or link to documentation of how to do this?

Patrick

1 Answer, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 12 Mar 2021, 03:52 PM

Hello Patrick,

The FileManager has a built-in Upload that allows the user to select a file from their file system. The file will be uploaded to the action specified in the FileManager's UploadUrl configuration, e.g.,:

.UploadUrl("MyUploadAction", "Home")

The FileManager allows managing files and sub-folders in a local folder, see our demo: https://demos.telerik.com/aspnet-mvc/filemanager To display the folders structure and allow interaction with them, e.g., uploading a file to a sub-folder, the FileManager communicates with the server through JSON. For instance if you navigate to a folder, the FileManager will send an AJAX request to the Read action and will pass the name of the folder (e.g., "Documents"). The Read action returns the content of the folder back to the client as JSON:

[
   {
      "Name":"ExcelDocument",
      "Size":12030,
      "Path":"Documents/ExcelDocument.xlsx",
      "Extension":".xlsx",
      "IsDirectory":false,
      "HasDirectories":false,
      "Created":"\/Date(1615550402665)\/",
      "CreatedUtc":"\/Date(1615550402665)\/",
      "Modified":"\/Date(1614168034000)\/",
      "ModifiedUtc":"\/Date(1614168034000)\/"
   },
   {
      "Name":"WordDocument",
      "Size":1128611,
      "Path":"Documents/WordDocument.docx",
      "Extension":".docx",
      "IsDirectory":false,
      "HasDirectories":false,
      "Created":"\/Date(1615550402743)\/",
      "CreatedUtc":"\/Date(1615550402743)\/",
      "Modified":"\/Date(1614168034000)\/",
      "ModifiedUtc":"\/Date(1614168034000)\/"
   }
]

The FileManager receives the JSON and then visualizes the data. In other words the FileManager does not manipulate files and folders directly. It sends data to the server, where the respective methods make the necessary manipulations: saving, removing, renaming files, etc., and the FileManager then visualizes whatever data the respective method returns to it.

You can review the implementation in the linked demo's View Source tab. The FileManagerDataController.cs file contains the actions called by the FileManager on uploading a file, navigating the folders, or executing actions over files and folders.

With regard to:

"I'd also like to do subsequently is after the file is processed, move the process file from the local drive folder or network share to a folder within the source folder as a way of letting the user know the file has been processed and should not be selected again."

This is subject of specific application business logic. It is not something that can be controlled from, or configured in the FileManager. The FileManager simply visualizes a structure of folders and files and provides the UI for the user to manage them, and upload additional files. What happens to the uploaded files once they are sent to the Upload action is in the scope of the respective service.

In addition to the demos, you can check out the following article that lists the fields the FileManager uses and expects the response from the server to contain: https://docs.telerik.com/aspnet-mvc/html-helpers/data-management/filemanager/binding/overview#remote-binding

If you have questions on a feature of the FileManager, its configuration, or API methods and events, feel free to ask.

Regards,
Ivan Danchev
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
FileManager
Asked by
Patrick
Top achievements
Rank 1
Veteran
Answers by
Ivan Danchev
Telerik team
Share this question
or