Reuploading same file

Hey all, so I’m running into a bit of a problem using the dcc.Upload component. Basically I want to populate a database with files using the contents from dcc.Upload as an input. However, if the user wants to populate the database by uploading the same file multiple times, it won’t work because the contents property technically hasn’t changed.

While there are solutions that involve using extra components, I’m hoping there might be a solution that doesn’t involve my user having to use multiple components to upload their files. Ideally, they would be able to click on dcc.Upload, select their file, and automatically have the database be populated with their data without clicking any extra buttons. Does any such solution exist?

1 Like

This question has been asked earlier in Can I Upload the same file twice in a row?. It seems it is a bug in the dcc.Upload component.

In this question on StackOverflow there are two proposed solutions

  • Modify the dcc.Upload component (JS code), ie. fix the bug in issue #816
  • Use another upload component, such as the du.Upload from dash-uploader.

I am the author of the dash-uploader package and could (of course) recommend using du.Upload over the basic dcc.Upload component in almost any uploads needs (With the exception when you do not want to write anything to the harddisk of the webserver).

I have added my answer to the the StackOverflow page (plotly dash - Problem dropping same file twice in a row - Stack Overflow), which was also mentioned by @fohrloop .

I posted a workaround: