Downloading path when working with Streamlit Cloud

Hi there,

I have coded my app and it works fine when I run it locally. My code generates a pdf that I want to download to a specific path on my computer.
I have deployed my app on the Streamlit Cloud but I get some errors since it’s not able to read the path I wrote in the “” function. How can I solve this?
Thanks!! :slight_smile:

My recommendation would be to simply save the generated pdf to the current folder that your app is running in, since you should have access to do that, and then use st.download_button to download it. If you need it to be saved in a specific place on your computer, you’ll then need to control that via your browser’s download dialogue.

1 Like

So is there no way to prompt a file explorer window like the st.file_uploader widget already does? That seems the right way to solve the problem, is that for whatever reason not possible?

While in-browser file selectors for uploading are very common (and come built in to every modern browser <input type="file"> - HTML: HyperText Markup Language | MDN), I’m not aware of a way to have an in-browser file selector for downloading. Maybe that’s possible, but I’m not sure. The default behavior in Streamlit is the same as in most web apps that I am aware of, which just downloads any file to the Downloads folder (or whatever folder you’ve specified as the default folder for downloads).

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.