File or folder selection dialog

Hello, we are using Dash and want a dash component that allows the user to conveniently enter paths of folders and directories on their computer. The dcc.Upload looks good, except that we only want the paths and we do not want to upload the files. Additionally, it would be useful to specify what file extensions are allowable, though this is not a strict requirement

Hi Ben,

Did you ever got this solved? I require exactly the same, a simple file dialog for convenient path selection.

Hi @ivo,

does this help?

As far as I understand, the functionality you describe is not supported natevely due to securicty concerns. I remember a forum topic about this but can’t find it now.


Thank you for your reply!
I already came across that topic yesterday, but I wanted to have a very quick solution :sloth:.

So for now I think I will let users simply paste the path manually without file dialog, as:

(1) the task will be rather rare (initial setup, changes best every few years)
(2) Not sure whether I would have access to the file system of the client when the app is hosted on an external server

However, since I am not familar I would be happy if you or someone els can provide me with a brief info why this is a security issue and how uploaders like dash-uploader circumvent this issue.

P.S.: In fact I used this callback to open a file dialog, but you must prevent the user from clicking the opening dialog a second time, otherwise the whole App is breaking! (Same problem with the file dialog of TKinter):

from PyQt5.QtWidgets import QApplication, QFileDialog

        def open_file_dialog(n1):
            app = QApplication([])
            directory = QFileDialog.getExistingDirectory(None, "Select a Directory")
            return directory