Download any file types based off trigger of button

I’m attempting to create an app where once a certain button is pushed, a file gets downloaded. The file types of these files include csv, yaml and md files. I’ve figured out how to make this work for csv files however I’m having trouble getting it to work for the other two. Instead of downloading file_name.yaml or file_name.md, the file gets downloaded without any file extension (just a simple textedit file). Any idea on how to help on this? Would be much appreciated.

Hello and welcome,

Please have a look at the documentation on Media files.

https://anvil.works/docs/media

You may try setting the media object’s name property.

There are other details that may be relevant depending on where your files are coming from (the file system, an HTTP endpoint, a datatable, a file loader, etc…), so have a look at the docs and see if you can find the right approach based on your situation.

2 Likes