st.file_uploader - Streamlit Docs -
I am trying to use a file uploaded ,but wanted to hide the small file icon and X button once the file is uploaded. This icons are also shown in the documentation listed in the link above. hen I try to use st.empty it removes the browse button and the ability to reupload
You can hide them with some css, like this:
import streamlit as st
files = st.file_uploader(
"Upload a file", type=["csv", "txt", "pdf"], accept_multiple_files=True
)
st.html("""
<style>
.stFileUploaderFile {
display: none;
}
[data-testid="stFileUploaderPagination"] {
display: none;
}
</style>
""")
st.write("Here are the files you uploaded:")
for file in files:
st.write(f"* {file.name}")
You can see it on the playground here.
thanks you so much .This worked .I played around with so many css without much luck.this worked like a charm .
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.