Describe the bug
The FileUpload onBeforeSelect and onSelect callbacks receive an incorrectly populated FileUploadSelectEvent.
Its files property contains the same values returned by getFiles() on the component ref, instead of only the newly selected files.
This makes it impossible to distinguish between newly and previously selected files.
In onBeforeSelect, the situation is even worse: the files property does not contain the newly selected files at all, since they have not yet been added.
Reproducer
No response
System Information
primereact: "^10.9.6"
react: "19.1.0"
Steps to reproduce the behavior
You can reproduce this in the "Template" example from the online demo:
https://primereact.org/fileupload/#template
Steps:
- Upload a 400KB image file.
- Then upload a 10KB image file.
Observed result:
The total file size reported is 800KB, because the onSelect implementation assumes files contains only the newly added files.
Expected behavior
files should contain only the newly selected files, allowing actions to be taken with respect to the new selection.
Describe the bug
The FileUpload
onBeforeSelectandonSelectcallbacks receive an incorrectly populated FileUploadSelectEvent.Its
filesproperty contains the same values returned bygetFiles()on the component ref, instead of only the newly selected files.This makes it impossible to distinguish between newly and previously selected files.
In
onBeforeSelect, the situation is even worse: thefilesproperty does not contain the newly selected files at all, since they have not yet been added.Reproducer
No response
System Information
Steps to reproduce the behavior
You can reproduce this in the "Template" example from the online demo:
https://primereact.org/fileupload/#template
Steps:
Observed result:
The total file size reported is 800KB, because the
onSelectimplementation assumesfilescontains only the newly added files.Expected behavior
filesshould contain only the newly selected files, allowing actions to be taken with respect to the new selection.