title | page_title | description | slug | tags | published | position |
---|---|---|---|---|---|---|
Limit the Number of the Uploaded Files |
Limit the Number of the Uploaded Files - RadCloudUpload |
Check our Web Forms article about Limit the Number of the Uploaded Files. |
cloudupload/how-to/limit-the-number-of-the-uploaded-files |
limit,the,number,of,the,uploaded,files |
true |
3 |
Common case is the need to limit the maximum number of files that can be uploaded. This article shows step by step how to create a custom limitation.
-
Add new RadCloudUpload control.
-
Set MultipleFileSelection property to true to enable Multi File Selection.
-
Handle [ OnClientFilesSelecting ]({%slug cloudupload/client-side-programming/events/onclientfilesselecting%})event.
<telerik:RadCloudUpload ID="RadCloudUpload1" runat="server" ProviderType="Azure" OnClientFilesSelecting="onClientFilesSelecting" MultipleFileSelection="Automatic">
</telerik:RadCloudUpload>
//Limit the number of the uploaded files.
function onClientFilesSelecting(sender, args) {
var uploadedFilesCount = sender.get_uploadedFiles().length;
var selectedFilesCount = args.get_count();
if (selectedFilesCount > 5 || (uploadedFilesCount + selectedFilesCount > 5)) {
args.set_cancel(true);
alert('You can upload up to 5 files.');
}
}
- [Troubleshooting]({%slug cloudupload/troubleshooting%})