Using File Explorer to upload files

I want to upload (and download) files to my PC using Dash.
Would someone point me (or show me please) how I can create a UI where the user can open a File Explorer to choose the file to load onto the PC or vice-versa. I don’t want the user to have to manually type in the full path.

thanks

See https://dash.plotly.com/dash-core-components/upload

Hi

Thanks. That solved 95% of my problem. Appreciate it.
However, it only seems to return the file name and contents. Not the path. Is there any way to find out the path so I can use that information?

thanks

@AlanA did you find a solution to this?

Hello @andrew-hossack,

What are you trying to do with the file?

Ideally I would like to allow a user to open a file location on their machine and return the absolute path from their machine. This app will be running locally and will use/modify the file directory they provide.

My current workaround is to prompt for the file path directly with a text input field.

Edit: Modern browsers don’t allow access to user file paths on document upload, so it’s not possible to retrieve the path from file explorer.

That is correct.

However, what you could do is allow them to download the modified file when they are done with it.

Or, if this is going to be a web application at a company, have a shared folder structure that they can iterate through via the portal. This would be more painful obviously than what your current workaround is.

The idea is to modify local git repositories in place. I considered uploading the entire file and downloading it back to the user after they had made changes, but in my context it didn’t seem to make sense.