Support Topics Documentation Slack YouTube Blog

Backendless.Files.saveFile javascript method return true instead of link

Backendless.Files.saveFile javascript method save the file but doesn’t return the url of file uploaded but only “true”. Why??

var savedFile = Backendless.Files.saveFile(loggedInUser.ownerId, fotoUser, file, true );
conslole.log(savedFile);

output: true

Hi Vincenzo

I have created an internal ticket to fix this issue (BKNDLSS-14050)

In a meantime, as a workaround, you should use asynchronous version of the method :

Backendless.Files.saveFile(loggedInUser.ownerId, fotoUser, file, true, new Backendless.Async(
   function onSuccess(fileUrl) {
    console.log(fileUrl)
   },
  function onError(err) {
   console.error(err)
  }
))