Creation of backend folders

It seems that there is no API to create a new folder on the backendless file system.
Is the only way to create a dummy file by using the path to the yet non-existing folder?

Regards,

Hello @Klaas_Klever!

We plan to add this feature in the near future (internal ticket BKNDLSS-26421).
We will let you know as soon as it’s ready.

Regards,
Alexander

@Alexander_Pavelko
This thread User images not saved - #10 by sergey.kuk
is mentioning a terminating “/” to create a folder
Is this the final recommended solution?

Regards

Hi, @Klaas_Klever

Yes, that is correct. The route for creating folders looks like this:

POST https://xxxx.backendless.app/api/files/<directory-path>/

Regards,
Marina

Hi @Marina.Kan
I can’t get this working for the Javascript API Backendless.Files.saveFile().
Could you provide an example that should work?

Thanks

Hello, an example from documentation works well for me

https://backendless.com/docs/js/file_save_files_from_byte_arrays.html

Regards, Dima.

Hi @Dima
I was trying to implement the use case of creating a plain new folder, instead of creating a new file.
I understood that with the REST API this works as POST https://xxxx.backendless.app/api/files/<directory-path>/.
However, I can’t get it working with the JS API:

Backendless.Files.saveFile( <path with '/' at the end>);   // doesn't work
Backendless.Files.saveFile( path,  <new folder name with '/' at the end);  // doesn't work

Has this feature of creating new folders been implemented for the JS API?

Thanks

Oh, sorry for that, I wasn’t clearly understood your last question.

Try this:

Backendless.Files.createDirectory(<path>)

This was easy! Works perfectly.
Please create a ticket for the team to extend the docs accordingly (Overview - Backendless SDK for JavaScript API Documentation)

Thanks

1 Like