File Manager - How to upload a file from an app without uploading from fileDialog

See https://snippet.webix.com/uf7j097h

I am trying to understand how to use webix.getService(“upload”) and any other service required so that I can call an api based on “wfs-s3”, by directly calling the api directly.

app.post("/upload", async (req, res, next)=>{
const busboy = new Busboy({ headers: req.headers });

busboy.on("file", async (field, file, name) => {
	console.log(req.body, name)
	const target = await drive.make(req.query.id,  name, false, { preventNameCollision: true });
	res.send(await drive.info(await drive.write(target, file)));
});

req.pipe(busboy);

})

Alternatively in the snippet how do I fulfill the method doFileSave() to save the myJsonFile object.

Hello,

In File Manager, we rely on drag-n-drop or file dialogues to add files for upload and on uploader logic to send them. So fileManager.services do not have a method to add a file in a different way.

However, you can define your own method. E.g. please have a look at this basic example: Code Snippet

Here:

  • I have defined the uploadFile method that sends a file in a POST request. The request must have the id parameter with the folder to which the file will be uploaded and FormData with the file (upload field) and the name of the file (upload_fullpath). This is how basically our uploader does this.
  • in the doFileSave function I create this file from your JSON string and give it to uploadFile.