Retool Storage - How do I get a file url from from a file id?

Hellooo - so I have some files uploaded to retool storage. I've recorded the file ids (the uuids) in a separate database. Is there some javascript that would convert a fileId to a url so people can view or download these files? These files are likely to be docs or pdfs.

Thanks!

1 Like

Not yet but we expect to support this by mid-late January! Thanks for the feedback

2 Likes

Thanks - for others, I ended up making a button to download the files instead

window.downloadingFile = item.fileId;
DownloadFile.trigger({
  onSuccess(file) {
    utils.downloadFile({base64Binary: file.base64Data} , file.name);
  }
});

I wanted to use additionalScope here, but i wasn't able to access it in the Retool Storage Query.

Here's what the DownloadFile query looks like:

1 Like

Thanks so much for sharing @parrisfvci !

1 Like

Heads up: we now have URLs supported. See here

1 Like

This syntax does not work anymore:

let file = query2.data

utils.downloadFile({base64Data: file.base64Data}, "cat", "jpeg")

// won't work

Instead, take this approach:

let file = query2.data

utils.downloadFile(file.base64Data, "cat", "jpeg")
// or utils.downloadFile({base64Binary: file.base64Data}, "cat", "jpeg")

// works like a charm!
1 Like