Can we disable file uploader yet retain the file uploaded in it?

Hi Streamlit community,

I am looking for a way to disable the Streamlit file_uploader, but retaining the file that has been uploaded to it. Do you know if this is possible?

See below a code example (which doesn’t quite work: every time I disable the file_uploader, any uploaded file gets cleared).

import streamlit as st

if 'disable_uploader' not in st.session_state:
    st.session_state.disable_uploader = False

def toggle_disable():
    st.session_state.disable_uploader = not st.session_state.disable_uploader


st.button('Button to disable/enable uploader',on_click=toggle_disable)