fileButton value not properly assigned?!

Hi,
I'm using a fileButton element to enable the user to upload an image to a S3 bucket. Therefore, I use a script that triggers once the fileButton event "change" is triggered. In the attached picture, you can see the first lines of the script as well as the output in the console.

How is it possible that the fileButton value is empty, even though a file has been selected and hence it should actually show the file contents?

Hi @strongbow :wave:

The value of fileButton1 is not accessible because you wrapped your JavaScript query within an async code block.

If you leave out the async code block, you should be able to access it like this:

To trigger the uploadSingleFileToS3 function from within a JavaScript query and ensure it completes before proceeding, simply prepend the await keyword directly to the function call. There's no need to wrap the function in an async block!

You can find more information about this topic in the Retool docs: Access data from an asynchronous function

Hope this helps!