import streamlit as st import os from glob import glob import time st.set_page_config(initial_sidebar_state="collapsed", page_title='File Upload') #Hide header style hide_st_style = """ """ st.markdown(hide_st_style, unsafe_allow_html = True) st.title("File Upload") uploaded_file = st.file_uploader("Choose a file to upload", accept_multiple_files=True) if uploaded_file is not None: for u_file in uploaded_file: bytes_data = u_file.read() with open(os.path.join(os.getcwd(),"files",u_file.name.replace(" ", "_")),"wb") as f: f.write(u_file.getbuffer()) st.success("File Uploaded") st.header("Available Files") st.caption("Meteo Rama") files_list = glob(os.path.join(os.getcwd(),"files","*.*")) table_html = "
| FileName | Uploaded On | Show | " for file in files_list: with open(file, 'rb') as f: table_html = table_html + f"
|---|---|---|
| {os.path.basename(file)} | {time.ctime(os.path.getctime(file))} | Show |