Remote Data
The Kendo UI FileManager provides a built-in DataSource which allow you to quickly set up and implement a remote data-binding functionality.
To bind the FileManager to remote data, specify the dataSource option and supply the object with the needed endpoints for read, create, update and destroy operations. The following example demonstrates such implementation, and the actual endpoints configurations could be found in here:
<div id="filemanager"></div>
<script>
$("#filemanager").kendoFileManager({
dataSource: {
schema: kendo.data.schemas.filemanager,
transport: {
read: {
url: "/kendo-ui/service/FileManager/Read",
method: "POST"
},
create: {
url: "/kendo-ui/service/FileManager/Create",
method: "POST"
},
update: {
url: "/kendo-ui/service/FileManager/Update",
method: "POST"
},
destroy: {
url: "/kendo-ui/service/FileManager/Destroy",
method: "POST"
}
}
},
uploadUrl: "/kendo-ui/service/FileManager/Upload"
});
</script>
The following list provides information about the default requests and responses for the create, read, destroy operations.
-
create—Makes aPOSTrequest for the creation of a directory with the following parameters.js{"name":"...","size":0,"path":"...","extension":".txt","isDirectory":...,"hasDirectories":...,"created":"...","createdUtc":"...","modified":"...","modifiedUtc":"..."} -
read—Makes aPOSTrequest that contains thepathparameter to specify the path which is browsed and expects a file listing in the following format:js[ {"name":"Documents","size":0,"path":"Documents","extension":"","isDirectory":true,"hasDirectories":false,"created":"\/Date(1578897289317)\/","createdUtc":"\/Date(1578897289317)\/","modified":"\/Date(1578897289332)\/","modifiedUtc":"\/Date(1578897289332)\/"}, ... ] -
destroy—Makes aPOSTrequest containingFormDatawith the following parameters:name—The file or directory to be deleted.path—The directory in which the file or the directory resides.extension— The extension of the deleted file. No extension in the data, if a folder is deleted.size&mdash The file size, as provided by thereadresponse.isDirectory— Boolean, specifying if the deleted is a file or not.hasDirectories— Boolean, specifying if the deleted contains folders.created— Created Date of the deleted item.createdUtc— Created Date in UTC format of the deleted item.modified— Modified Date of the deleted item.modifiedUtc— Created Date in UTC formats of the deleted item.
-
update—Makes aPOSTrequest, containing theFileEntryobject. The expected response is afileobject in the following format:js{"name":"...","size":...,"path":"...","extension":".txt","isDirectory":...,"hasDirectories":...,"created":"...","createdUtc":"...","modified":"...","modifiedUtc":"..."}