S3 Download File - Download not working

Hi,

Hope someone can help. Apologies their are several posts like this on the forum but I have read them all and still can’t find a solution.

I have a download file button located in a form inside a repeating table.

The form actions a server api and passes the S3 Key for the file to download

The server action is successful with a 200 response, however the content returned ( Looks like binary)

and the file isn’t downloaded within the browser.

I have double checked the CORS policy and Content- Disposition and are all set up correctly.

Screenshot_16

I have probably missed something! if anyone could help with why the file isn’t downloading that would be great! Thanks

How do you link to the server action for download? Just regular link A tag? Try adding download attribute

Hi @George, thanks for your reply.

I link to the server action via the download button which is part of a form on the table. the ID (Key for s3 file) is sent on the form submit. I don’t have a link on the front of the app just the button that sends & submits the s3 file key to the server connect file that triggers the download file action.


Screenshot_20

I am assuming I am missing something on the front app?

Thanks for your help.

Unfortunately the “download” attribute is only valid on A tags (links) and not buttons:

with your button you are triggering form submit, but that is not a download.
So maybe just make a link out of this instead of form submit.

Thanks @George that solved it!