After an upload the uploaded file is displayed and the upload button is disabled. The only way to upload another file is to delete the first, in which case the upload button is enabled again.
Can this component be used at all for more than one upload or do I have to re-initialise it every time?
Duh, thank you very much! I thought this parameter was for multi-file uploads only. Is there a way to set this number to “unlimited” short of using a ridiculously high number? The API states that unlimited is the default, but that seems to be wrong?
Also, can I avoid that the uploaded files are listed below the button? I have implemented my own listing below the component, so this is somewhat redundant.
CSS is difficult, because the list is in the shadow DOM. I can manipulate it via theming, but that would affect all Upload components, not just the one I am targeting. At least I don’t know how to target a specific component only:
You can use a theme attribute. The example I linked above does so. If you’re using Vaadin’s web components, they will automatically propagate the theme attribute to any child components.
I believe that doesn’t work, because the theme attribute will be on the “vaadin-upload” element, whereas the element I need to target is “vaadin-upload-file”, which is in the shadow root of “vaadin-upload”. And the “vaadin-upload-file” does not have the theme attribute.
You don’t need to hide vaadin-upload-file; the following should be enough (themeFor="vaadin-upload" and the Upload component should have the attribute theme with the value custom-upload):
The weird thing is, even if I clear the list of uploaded files via one of the workarounds mentioned in https://github.com/vaadin/vaadin-upload/issues/339, some pointer to the just uploaded file is still retained. Because on the following upload I am getting two events of type com.vaadin.flow.component.upload.SucceededEvent - one for the file from the previous upload and one for the file from the current upload. The order of those events is arbitrary.
Wasn’t successful creating the small sample. It appears to either be a Browser/OS specific thing the way the upload is handled and/or timing-dependent (Selenium can reproduce it, me manually not). Needs more investigation.