Can Streamlit open a folder and read the file inside?


At present, the showDirectoryPicker() window API call is supported by Chrome, Edge, and Opera browsers.

async function getDir() {
  const dirHandle = await window.showDirectoryPicker();

  // run code for dirHandle

Is there any method to open folder by st.file_uploader currently?


By the way, the Live(Online) Demo of Logseq can be as an example. The user can open a folder and create a logseq vault inside.

You cannot show a directory picker, but you can drag and drop a directory into the file uploader.

But it seems that there is no info for structure of the folder.

All the files choose by selector only has its filename. :sob:

That is right, no info on where the bytes come from is passed to the application other than the bare file name.

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