Upload component: disable "upload" button?

Hello everyone,

we are using the Vaadin “Upload” component in our web application to enable the user to upload custom icons for visualization purposes. During a review, we discovered that the “Upload” button is clickable even if there is no file selected, resulting in an upload error. What we would like to do is to enable the upload button itself only if a file is selected, and disable it otherwise (for usability reasons). Unfortunately, the “setEnabled(…)” method of the Upload component always disables everything (including the “browse” button).

Did anybody else face this issue? I checked the Book of Vaadin, but couldn’t find anything about this…



As described in the
API documentation for Upload
, you can hide the upload button with setButtonCaption(null). In that case, you need to have a Upload.ChangeListener to detect changes in the file selection and then call submitUpload() to start the upload. This method also allows choosing multiple files before starting upload for all of them simultaneously.

This solution is not good enough.
We want to use the upload button , but I dont see how enabling the button before selecting a file is not a bug??