How To Cancel And Remove Certain Files When Using Telerik RadAsyncUpload


Have you ever wanted to remove certain files, when using RadAsyncUpload control in multi select mode?  The problem is, you calling cancelUpload in the Uploading event cancels all uploads.  That is not idea for obvious reasons.



var errorFiles = '';

//OnClient Uploading Event
function onClientFileUploading(sender, args) {

     //if some condition is met, then cancel the upload, and add the filename to a variable.
     alert('alert user possibly that file will be removed');

     //cancel the upload

     //add to error list, we will need to remove in the Uploaded it still fires.
     errorFiles = errorFiles + currentUploadedFilename.toUpperCase() + '|';

//OnClient Uploaded Event
function onClientFileUploaded(sender, args) {
     //create array of file names
     var filename = errorFiles.split("|");
     var count = filename.length;
     //process each filename
     $.each(filename.reverse(), function (key, item) {
          if (args.get_fileName().toUpperCase() == item.toUpperCase()) {
               //remove click
               $telerik.$(".ruRemove", args.get_row()).click();
               filename[key] = '';
     errorFiles = '';
     $.each(filename.reverse(), function (key, item) {
          if (item.length > 0) {
               errorFiles = errorFiles + item.toUpperCase() + '|';



This snippet of code, will allow you to choose files to cancel during the upload process, and then automatically remove them from the list of documents automatically.