Upload's setMaxFiles doesn't work.
mlindfors opened this issue · 0 comments
mlindfors commented
Description
If I try to use upload.setMaxFiles(3);
, the limitation doesn't work. On the client I can see that the maxFiles property is still "Infinity".
Expected outcome
I would expect the component to respect the max files setting.
Minimal reproducible example
Just go to https://vaadin.com/docs/latest/components/upload#file-count, and select Flow from the examples.
Steps to reproduce
- Click the "Upload files..." button in the documentation example.
- Select multiple files from the file browser, just make sure the amount is higher than the assumed limit of 3.
- See how there are no notifications, and the component happily accepts all the selected files.
I can force the setting through an executeJs call as a workaround: upload.getElement().executeJs("this.maxFiles = 3;");
Environment
Vaadin version(s): 24.4.11
OS: macOS, but isn't OS-related in any way.
Browsers
Chrome, Firefox, Safari