How to save the uploaded rar, zip, 7z file through st.file_uploader and save them to specific directory of server?

If we upload picture, we can use PIL to save them to server.
If we upload csv or excel, we can use dataframe.to_csv or dataframe.to_excel to finish save task.
How about we upload rar, zip, 7z file, how should we save them to server?
Thank you.

For any arbitrary file type being passed to file_uploader, you can take the BytesIO buffer and write it to disk:

Best,
Randy

1 Like