Retrieving the files list from the <Upload> component

1 Answer 79 Views
Upload
David
Top achievements
Rank 1
David asked on 10 May 2023, 05:44 AM

I know that each listItemUI child has info about the file passed into it by props,

but is there a way to get a full list from the parent <Upload> component?

A callback function maybe?

for example:
<Upload getFileList = {getFileList} />

const getFileList = (list) => {
     console.log(list);
}

1 Answer, 1 is accepted

Sort by
0
Wissam
Telerik team
answered on 11 May 2023, 01:58 PM

Hello, David.

I would suggest rendering the Upload component in a controlled mode.

This can be achieved by handling its onAdd, onRemove, onProgress, and onStatusChange events. These events contain the `affectedFiles` which shows the list of affected files, and the `newState` which contains all the files. In addition, you should set a state variable to the `newState` and pass it to the files prop.

This will allow you to access all the uploaded files through this state variable:

For more information about rendering the Upload component in controlled mode, check the following article:

I hope this matches what you need, but please let me know if you have any further questions.

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Tags
Upload
Asked by
David
Top achievements
Rank 1
Answers by
Wissam
Telerik team
Share this question
or