Skip to content

FileUpload: FileUploadSelectEvent files property contains wrong values #8242

@thingersoft

Description

@thingersoft

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:

  1. Upload a 400KB image file.
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Needs TriageIssue will be reviewed by Core Team and a relevant label will be added as soon as possible

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions