How to save changed text-file with filemanager?

(new to webix)

When I select a file within my filemanager, it loads the file’s text content into a textarea. After changing the text in the textarea, I want to click a “Save” Button to store the changed textarea’s text back into the existing file.

At the moment I create a new File() and add it to a new FormData(), which I upload with XMLHttpRequest.

This is probably not the webix way to do this?

Hello,

you can try to use Uploader for file upload:


webix.ui({
	id:"uploadAPI",
	view:"uploader",
	upload: "upload.php",
	apiOnly:true
});

var file = new File(...);
$$("uploadAPI").config.formData  = {target: "myFolder"};
$$("uploadAPI").addFile(file);

formData - parameters that will be sent with the uploaded file.

Yes, that works. Thank you, Maria for the fast response. Had to copy and change ‘upload.php’ also that it allows overwriting existing files.

What I still wonder is: ui.filemanager itself has already an uploader on board, at least that’s what I assume with $$(‘filemanager’).getUploader().
Can’t I use the filemanagers uploader API?

Can’t I use the filemanagers uploader API?

You may try )

FileManager uses event handlers for its Uploader that manipulate selected folder. I’m not sure whether your implementation will work correctly with these handlers.