Default file upload

Hey,

I added a file_uploader field to my app (Thanks for this itโ€™s amazing) and I was wondering if there is a way to set a default upload, much like how other fields like text_input have value as a keyword that I can use to set the default.

Thanks,

Kurt

Hey @kurt-rhee,

Thereโ€™s no way to specify a default file for the uploder but you could check that fairly easy because when thereโ€™s no file uploaded it will return None .

So you could do something like:

  uploaded_file = st.file_uploader("Choose a CSV file", type="csv")

  if uploaded_file is None:
     # Some default stuff here :)
  else:
    data = pd.read_csv(uploaded_file)
    st.write(data)

Thanks @arraydude Iโ€™ve implemented the file uploaded like so in my app!