File browser to select a folder or a file

Hi @TPMStreamer

Here’s a code snippet from @Adrien_Treuille that allows you to browse through files on the server using the st.selectdown() widget:

import streamlit as st
import os

def file_selector(folder_path='.'):
    filenames = os.listdir(folder_path)
    selected_filename = st.selectbox('Select a file', filenames)
    return os.path.join(folder_path, selected_filename)

filename = file_selector()
st.write('You selected `%s`' % filename)