clearFile

Visually removes all files from the UI for which the callback function returns true without issuing requests to the remove handler.

Example

<input name="files" id="files" type="file" />
<button id="clearFile" class="k-button">Clear 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"
      }
    });

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

      var upload = $("#files").data("kendoUpload");
      upload.clearFile(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
Not finding the help you need? Improve this article