Store File/Images from retool to SQL

Is there any way to store files in SQL Server using retool without the need to decode or encode?

I've tried the file upload using the
" .value string[] 'The selected files as base64 encoded strings' ". and I'm not sure how to move on from there.

Any help means a lot

Thank You.

Try it with using your value string or try another value i believe that's your problem
Tommy L. Triplett Jr.
May 7 1976
T.I.W.W.D.O !!!!!

Hi @junior_developer Thanks for reaching out! If you're still blocked, it would be helpful to see a screenshot. Are there any errors?

Are you using {{fileButton.value[0]}}?

The query to insert files and to store it in the database

The event handler for file upload button
image

The query for submitting the file to the database

the file only appears in base64 format
image

Let me know if you are having trouble understanding the above statements.
Thank You!

I've tried but the value either displays in base64,null,empty and [object][object]. Literally tried all the method values but no progress at there.

Hi @junior_developer Thank you for the screenshots!

What is the file type? Are you only working with images? What is the column type of "FileUP"?

When does FileUploadSupp get triggered? It looks like the file is uploaded via one of our upload components, which triggers the submitToAudt_database query

It may not be relevant for images, but if you're uploading a file with text and only want to pass some text to a database, you may want to try toggling on 'parse files' from the upload component, which will create a property with the file's content

Hi @Tess Thank you for getting back to me as soon as you could.

I want to upload all kind of files like excel,images and text files.
My column for FileUp is Varbinary(MAX).
It gets triggered once a user chooses the type of files they would like to upload for approval and clicks submit that's when the desired file will be saved in a database.

Hi @junior_developer!

Thanks for these details. I don't have a ton of experience with MSSQL's varbinary type, but I used the second response in this external post to get this working. I hope it helps! :crossed_fingers:

I also checked internally & saw that we have a feature request for making it easier to work with Varbinary data in Retool. Hopefully, that is something we can ship in the future to make this more intuitive!

1) Insert file from fileButton component. In this case, I am using an image.

2) Query that file in Retool. If needed, convert the file into base64 in order to display the uploaded image in an image component: