File size: 1,443 Bytes
ca8935b
7d7cace
ca8935b
8dba553
c892be7
55c2f3f
 
 
 
 
 
 
 
 
 
c892be7
55c2f3f
 
 
 
 
c892be7
 
ccb54a0
 
 
 
 
 
 
 
 
 
19dad51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import streamlit as st
import os

path = "/data"

# Define the modal dialog function
@st.dialog("Upload a File")
def upload_file():
    uploaded_file = st.file_uploader("Choose a file")
    if uploaded_file is not None:
        file_details = {"FileName":uploaded_file.name,"FileType":uploaded_file.type}
        st.write(file_details)
        with open(os.path.join(path,uploaded_file.name),"wb") as f: 
           f.write(uploaded_file.getbuffer())         
           st.success("Saved File")

# Main app
st.write("Click the button to open the file upload dialog.")
 
if st.button("Open File Dialog"):
    upload_file()





# List all files in directory and subdirectories
files = []
for root, dirs, file_names in os.walk(path):
    for file_name in file_names:
        files.append(os.path.join(root, file_name))

st.write(files)

from streamlit_extras.stylable_container import stylable_container

st.markdown(
    '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css"/>',
    unsafe_allow_html=True,
)


with stylable_container(
    key="container_with_border",
    css_styles=r"""
        button p:before {
            font-family: 'Font Awesome 5 Free';
            content: '\f1c1';
            display: inline-block;
            padding-right: 3px;
            vertical-align: middle;
            font-weight: 900;
        }
        """,
):
    st.button("Button with icon")