Possibility to download multiple files via a single link/module?

Hi guys,

I’m building a machine learning app and I would like users to be able to download model weights and all related files (5 files in total).

For file downloads, I’m usually using this little hack

csvAll = dfSorted.to_csv()
b64 = base64.b64encode(csvAll.encode()).decode()
href = f'<a href="data:file/csvAll;base64,{b64}" download="all.csv">** ⯈ Download all results.**</a>'
st.markdown(href, unsafe_allow_html=True)

… while working, it only allows for one file download at a time, which wouldn’t be a convenient solution here.

Is there a way to download multiples files?


Found a workaround

#1 Zip all files
#2 Download zip files! :slight_smile:

Code here: zipThenDownloadStreamlit.py · GitHub


1 Like