Get the Filename of the Uploaded File

I am trying to retrieve the name of the file, I have just uploaded in Streamlit using st.file_uploader(). This is my code:

file_buffer = st.file_uploader("Choose a CSV Log File...", type="csv", encoding = None)
if file_buffer:
    uploaded_file = io.TextIOWrapper(file_buffer)
    if uploaded_file is not None:
        df = pd.read_csv(uploaded_file)

And if I upload test.csv file, I want to retrieve the name of the uploaded file and save it to a variable.

Thanks in advance.

1 Like

Corresponding GitHub issue: