import streamlit as st from pathlib import Path from pages.table import generate_files st.set_page_config( page_title="Dokumentenupload", layout="wide", initial_sidebar_state="expanded", ) st.markdown("# Dokumentenupload") st.sidebar.markdown("# Dokumentenupload") UPLOAD_FOLDER = 'C:/Users/keckm/Documents/GitHub/Streamlit/files' # Ordner für Dateiablage def save_file(uploaded_file): save_folder = UPLOAD_FOLDER save_path = Path(save_folder, uploaded_file.name) with open(save_path, mode = 'wb') as w: w.write(uploaded_file.getvalue()) if save_path.exists(): st.success(f'Dokument {uploaded_file.name} wurde erfolgreich auf den Server hochgeladen.') # file uploader with st.form('upload_form'): uploaded_file = st.file_uploader("Wählen Sie eine Datei aus.", type = [ ".pdf"]) submit = st.form_submit_button(label='Hochladen') if uploaded_file: filename = uploaded_file.name save_file(uploaded_file) generate_files()