Hi community, I’m trying to upload a zip file to my app, using this:
uploaded_zip = st.file_uploader('XML File', type="zip", encoding="latin1")
if (uploaded_zip is not None):
zf = zipfile.ZipFile(uploaded_zip)
And returngin “BadZipFile: File is not a zip file”
Can I use this?
Hi rfgallon,
I can’t reproduce your error with the given code snippet and a random zip file from my local machine.
Therefore, I assume that this is not a streamlit issue, but rather something about your zip file that zipfile.ZipFile()
can’t handle. Maybe this thread is helping you: https://stackoverflow.com/questions/3083235/unzipping-file-results-in-badzipfile-file-is-not-a-zip-file.
Best wishes,
Marcus
1 Like