How do I check for what file type a file is after uploading to st.file_uploader()? For example, I’ve allowed st.file_uploader()
to accept .pkl
or .gzip
files but have to perform a different operation for each.
Hello @vnguyendc,
If using two st.file_upload()
is not an option, you could use a library to get the file type from your BytesIO
.
Thanks @okld I’ll check this out. I actually approached this using ‘try except’ statements, and seems to be working alright. But this looks useful.