File size: 950 Bytes
ff1f92b dd7ae9e ff1f92b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
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 = './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()
|