New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Prevent Dual File Uploading

This article shows step by step how to prevent dual uploading of a file which has already been uploaded.

Prevent Dual Files Uploading

  1. Add new RadCloudUpload control.

  2. Handle OnClientFileUploading

<telerik:RadCloudUpload ID="RadCloudUpload1" runat="server" ProviderType="Azure" OnClientFileUploading="onClientFileUploading" MultipleFileSelection="Automatic">
</telerik:RadCloudUpload>
//Prevent uploading of file, which has already been uploaded.
function onClientFileUploading(sender, args) {
    var fileName = args.get_fileName();
    var uploadedFiles = sender.get_uploadedFiles();
    for (var i = 0; i < uploadedFiles.length; i++) {
        if (uploadedFiles[i].originalFileName === fileName) {
            args.set_cancel(true);
            alert(fileName + ' has already been uploaded.');
        }
    }
}

See Also

In this article