In many cases, you don’t actually need the filename
- The contents of the file are contained through the contents
property of the dcc.Upload
component. And note that if your app is deployed on a server, you won’t be able to read a file given by the “filename” as that file won’t exist on the server.
If you need to refer to a saved file, then you can just save the contents
property to the disk and make up the filename yourself.
If your app is reading files on a local machine, i.e. if you aren’t deploying your app to a server, then an alternative to using the dcc.Upload
component would be to display a list of files in a dcc.Dropdown
component and allow the user to select a filename.