removeFile

Removes all files for which the callback function returns true by sending a standard remove request to the handler.

The invoking of the removeFile method does not trigger the remove event.

In a chunk upload scenario the method will not work for files that are not fully uploaded and saved. To remove a file that has been canceled call the remove handler manually.

Example

<input name="files" id="files" type="file" />
<button id="removeFile" class="k-button">Remove non-image files</button>
<script>

  $(document).ready(function() {
    $("#files").kendoUpload({
      async: {
        autoUpload: false,
        saveUrl: "http://my-app.localhost/save",
        removeUrl: "http://my-app.localhost/remove"
      }
    });

    $("#removeFile").on('click', function(e){
      e.preventDefault();

      var upload = $("#files").data("kendoUpload");
      upload.removeFile(function(file){
        switch (file[0].extension) {
          case '.jpg':
          case '.img':
          case '.png':
          case '.gif':return false;
          default: return true;
        }
      });
    })
  });
</script>

Parameters

callback Function
In this article