Get path information at nested files uploading

How can I reproduce the file structure on the server side when I upload a file that has the following nested folder structure?

folder1/
    file1.txt
    folder2/
        file2.txt
        filder3/
            file3.txt

With file_uploader(accept_multiple_files=True) the `name`` property contains only file names and does not give folder names.

Test code is here.

uploaded_files = st.file_uploader("", accept_multiple_files=True)
if uploaded_files:
    for file in uploaded_files:
        st.text(file.name)

Drag and drop root folder folder1 and you get

I hope to get like this:

folder1/file1.txt
folder1/folder2/file2.txt
folder1/folder2/folder3/file3.txt

I found this issue Let file_uploader return path, instead of reading the file in · Issue #904 · streamlit/streamlit · GitHub
Thanks.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.