limit the number of files to upload

1 Answer 19 Views
Upload
Sean
Top achievements
Rank 1
Sean asked on 25 May 2021, 04:56 AM
How can I limit the number of files to upload with the Kendo UI Upload widget?  

1 Answer, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 27 May 2021, 11:33 AM

Hello, Sean,

As the Upload does not have a built-in file number limitation, you can use the code below to achieve the requirement.

function select(e) {
    var files = e.sender.getFiles();
        if (files.length >= 5) {
            alert("Please select max 5 files.");
            e.preventDefault();
        }
}
Here is a small example for reference.

Let me know if you have any further questions.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Upload
Asked by
Sean
Top achievements
Rank 1
Answers by
Martin
Telerik team
Share this question
or