1

I'm using Primereact's file upload component with customUpload prop and Uploadhandler callback. I want to change the status of the uploaded file when my uploadHandler function finishes executing.

<FileUpload className={`w-full`} name="demo[]" customUpload={true} uploadHandler={async (e) =>{
} }.... /> 

enter image description here

Melloware
  • 10,435
  • 2
  • 32
  • 62
Ibra
  • 912
  • 1
  • 12
  • 31

1 Answers1

1

Yes but you must be using PrimeReact 9.6.0 which was released today. just make sure you get a ref to your FileUpload.

<FileUpload ref={ref} ...

Then with that ref you can update the list of uploaded files like..

const yourFiles = []; // array of your already uloaded files
ref.current.setUploadedFiles(yourFiles);
Melloware
  • 10,435
  • 2
  • 32
  • 62