Uploading an image to S3 via File Picker

I have a working S3 resource set up in retool -- I'm able to upload a text file to S3.

I can't figure out how to upload an image from filepicker. Can I plug in the FilePicker file data as a "binary" type into the S3 uploader? Related, the binary type on S3 Uploader seems to either be broken or not compatible with filepicker (related post)

It's possible that filePicker.file.data needs to be converted to some other format for binary uploads? Any help is appreciated.

BTW, it seems like filePicker.file.data is base64 encoded, running that through atob() appears to give me binary data.

Still, the S3 Uploader fails with the error Cannot read property 'file' of null as mentioned in the linked thread.

Hi @abvs!

It's a little strange, but if you are using a filepicker for an s3 upload, you'll need to use the full .file property in the upload data setting, rather than the .file.data property.

Hi Alex, thanks for your response!

Unfortunately I am getting the same error as before. I tried using {{ filePicker1.file }}, {{ filePicker1.file[0] }} to no avail. Screenshot below.

Any other ideas? Thanks!

This actually did work for me, but I had to trigger the action using a button. The preview function does not work.

1 Like

Good call @byron - thank you!

@alex-w FYI this process works when the action is triggered using a button but not when manually triggered with the play button.

The "play" button is a hot topic internally :laughing:, it is really a "preview" button and we're going through the process of rebuilding the UI and experience there to more clearly separate out previewing and running a query. The goal for the preview is to non-destructively give you an idea of what the query will do, but the behavior is a little inconsistent across resource types right now. We're hoping to be wrapping up and shipping the first steps on that project over the next 4 weeks or so