Core component allow select folder

Is there a core component allow user to browse to a folder and return the path of that selected folder? Please tell me how to do it.

2 Likes

Hi, anyone can help me with this?

Do you mean the upload component? You can Drag and Drop or Select Files with it.
https://dash.plot.ly/dash-core-components/upload

I prefer to allow user open a directory dialog like the one below
image

But if it is not an option then I might have to use upload component. Can I upload multiple files at one time?

3 Likes

You can select files with the directory dialog in the upload component. And you can select multiple file.

The ideas is if I have many files in that folder, I don’t want user have to drag a bunch of files. But look like I don’t have another option.

Is there anything like this by now?
I don’t want to select files with the upload component, I just want to be able to select a folder.
Currently in my app the user has to type in the path, and it would be much more convenient if he can just select it.

1 Like

I also have this requirement, this is why my application not using dash, waiting for dash’s improvement.
A directory selector is very useful for local app users and for big file data analysis scenario. The upload component is very slow with big files transmitting to local sever(not need by local data analysis).

1 Like

A quick workaround would be to add type “filedirpath” to input like type “text” plus filedirectory validation. Equivalently a type “filepath” could added as well w.o. much overhead.

It seems like plotly dash doesn’t have such opportunity. But you can create a button and use tkinter as callback:

import tkinter
from tkinter import filedialog

root = tkinter.Tk()
root.withdraw()
directory = filedialog.askdirectory()
root.destroy()

I don’t get the tkinter solution to work. Apparently the dash main thread and the tkinter main thread interfere with each other.