URL is undefined after uploading File

Howdy folks. I’m doing the following:

const file = new Moralis.File(thumbnail.name, thumbnail)
file.save().then(() => {console.log("file saved correctly")},(error)=> {console.log(error)});

If I do console.log(file), I can see the variable _url has the correct image url, but when I try to save it in a variable, doing const var = file.url(), I get undefined.
What could be the problem here?

You can have something like this

let fileUrl;
function uploadFile() {
  //.... Your code Implementation to grab the file before saving

  const file = new Moralis.File(thumbnail.name, thumbnail);
  file.save().then(
    (fileInfo) => {
      fileUrl = fileInfo.url();
      console.log(fileUrl)
      console.log("File saved correctly");
    },
    (error) => {
      console.log(error);
    }
  );
}