dash-uploader icon indicating copy to clipboard operation
dash-uploader copied to clipboard

Multiple Upload components on different pages

Open jonte14 opened this issue 2 years ago • 1 comments

Hi.

What I want to do principally is the following:

Page 1: main.py Here the app is initiated etc

Page 2: upload_agreement.py Here the user can upload a signed and filled agreement. It should be put in a specific folder "data/$UserName/agreements"

Page 3: upload_images.py Here the user can upload images (Multiple files) These should be put in specific folder "data/$UserName/images"

I am able to make this work with 2 pages by getting the app instance with dash.get_app(). In this way I use du.configure_upload(app, output_folder)

However, with 3 pages, I have not found a solution. The problem is that it seems that du.configure_upload(app, output_folder) must be present on the page where the du.Upload component is instantiated. However, when I add du.configure_upload(app, output_folder) to Page 3 I get the error:

AssertionError: View function mapping is overwriting an existing endpoint function: get

So it seems that the endpoint is defined globally, but still, the du.configure line must be present on each page where I use du.callback. But I cannot have this line present on all pages since that overwrites the endpoint of dash-uploader.

Is there a workaround?

jonte14 avatar Oct 03 '23 08:10 jonte14

It's been a while since the question has been asked, but I would also like to know how to use du.callback() on multiple pages. I have my du.configure_upload() in my app.py.

I am able to define the download folder by returning the du.Upload() in a normal callback with a specified upload_id that I get from Input("url", "search"). But I need to have a `du.callback()' to trigger other stuff when the upload is finished...

nils-fl avatar Jun 03 '24 09:06 nils-fl