Hi guys,
File (image) upload in retool is super easy and works almost automatically.
What I dont understand is how to associate an uploaded image to a key of a sql table.
And if so, how to show a gallery with all the uploaded files(images) with that key?
Hi @TomJaud, I think your best bet would be to create and maintain an association between the SQL table keys and the id
and/or url
of each uploaded file in some external data source. The URL for each uploaded file will be https://<yourRetoolDomain>/api/file/<uniqueIdOfFile>
. So with a table storing SQL table keys with associated file id
s you could query for all file id
s associated with a specific SQL table and create a list of the file url
s to display in an Image Grid Component. Or if you store the file url
with the SQL table keys, you could just fetch the file url
s directly.
Ok, but my challenge is to get the automatically assigned Retool storage id as a return value. Do you have any information on how to get it?
Hey @TomJaud The uploaded file id is included in the response when you run an Upload file query to your Retool Storage resource.