Skip to content

Latest commit

 

History

History
48 lines (32 loc) · 1.45 KB

limit-the-number-of-the-uploaded-files.md

File metadata and controls

48 lines (32 loc) · 1.45 KB
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

Limit the Number of the Uploaded Files

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.

Limit the Number of the Uploaded Files

  1. Add new RadCloudUpload control.

  2. Set MultipleFileSelection property to true to enable Multi File Selection.

  3. 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.');
	}
}

See Also

  • [Troubleshooting]({%slug cloudupload/troubleshooting%})