vaadin/flow-components

Upload's setMaxFiles doesn't work.

mlindfors opened this issue · 0 comments

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

  1. Click the "Upload files..." button in the documentation example.
  2. Select multiple files from the file browser, just make sure the amount is higher than the assumed limit of 3.
  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