Skip to content

FileUpload : Image Upload Error: Previous Image Not Clearing After Upload Failure #7740

@MuzammilAsghar0987

Description

@MuzammilAsghar0987

Describe the bug

When clicking on the upload button and encountering an upload error, the previous image remains in the data-pc-section="content" field even after multiple failed attempts. Before the upload, the image selection works fine. However, after an error occurs during the upload process, selecting a new image shows both the previous and the new image. This issue persists across multiple attempts.
Note : multiple prop is false.

Reproducer

https://stackblitz.com/edit/vitejs-vite-j6olr6ee?file=src%2FApp.tsx

System Information

System:
    OS: Windows 10 10.0.17763
    CPU: (6) x64 Intel(R) Core(TM) i5-9400F CPU @ 2.90GHz
    Memory: 8.41 GB / 15.94 GB
  Binaries:
    Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.21.1 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
    npm: 10.8.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.17763.1.0)
    Internet Explorer: 11.0.17763.592
  npmPackages:
    primereact: ^10.9.1 => 10.9.2
    react: ^19.0.0 => 19.0.0
    tailwindcss: ^3.4.17 => 3.4.17

Steps to reproduce the behavior

  1. Select an image to upload.
  2. Encounter an upload error.
  3. Select a new image for upload.
  4. Both the previous and the new images are displayed.

Expected behavior

The previous image should be cleared from data-pc-section="content" after each failed upload, ensuring only the newly selected image is displayed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugIssue contains a defect related to a specific component.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions