file manager upload of directories

Hello,

I’m trying to implement the upload of a directory and its content.

I was able to create the server-side part to receive and store the content but am a bit confused about the Json to reply to the client to avoid that all uploaded files are improperly assigned as children of target folder.

For example assuming that the directory structure is the following (d1,d2 are sub-directories of d; d1 has two files, d2 has one file)

d
–d1
----f1.txt
----f2.txt
–d2
----f3.txt

When I upload the directory d in the target folder T, the right structure is created on the server but unfortunately I get all the following tree items as children of the target T (only the directory d should be visible in T as it’s the only immediate child)

d/d1/f1.txt
d/d1/f2.txt
d/d2/f3.txt

If I refresh the client, then everything gets fine and the right structure is visible.

Is there any way to control the items that are added to each level of the tree in the file manager?

thanks
regards
gianni

Hello,
You can get the item with the help of getCurrentFolder which gets the name of the folder selected in Tree. Then it’s need to remove all items via clearAll and use load method. With the help of the last method you can use setPath which selects a certain folder and sets path values for it.
Please check the sample: https://snippet.webix.com/o6wpj92w
Just add a path to your file/script

Thanks for the reply. I’ll try it out!