File uploading using JavaScript API

Hi,
I am currently trying to upload a file to the Backendless system with the JavaScript API (v6.2.2) from our Angular application. The upload works as intended, however, the function Backendless.Files.upload(…) returns “Promise<void>” and not a “Promise<string>” or something else for the new URL of the uploaded file.
Is this signature intended and if so, how can I convert the returned value to a string to work with it in my code?

const uploadPath = "/devices/images";
Backendless.Files.upload(file, uploadPath, true)
  .then(function(fileUrl) {
    // imageUrl: string
    device.imageUrl = fileUrl;
  })
  .catch(function(error) {
    //...
  });

Thanks in advance,
Tim

Hello @Tim_Riemann

Thanks for pointing it out!
I’ve created an internal ticket BKNDLSS-24135 to fix it

Regard, Viktor

Hello @Tim_Riemann

We have released this fix already in v6.2.3 JS-SDK
Happy coding with Backendless!

Regard, Viktor

1 Like

Thanks for the fast update. It is working fine now!