Book Image

Kendo UI Cookbook

By : Sagar Ganatra
Book Image

Kendo UI Cookbook

By: Sagar Ganatra

Overview of this book

Table of Contents (18 chapters)
Kendo UI Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Listening to file upload events


Before the advent of HTML5, the only event listener that was available with XmlHttpRequest was the readystatechange event listener. In HTML5, several event listeners have been added to the XmlHttpRequest interface: loadstart, progress, load, abort, error, timeout, and loadend. In this recipe, we will see the various event listeners that can be attached to the file uploader widget and the sequence in which these events are executed.

How to do it…

The file uploader widget shows you the progress of the files being uploaded and shows the status as completed when all files have been uploaded. However, in many instances, you would like to attach listeners and listen to various events:

$('#fileUpload').kendoUpload({
  
  async: {
    'saveUrl': '/fileUploadService/save',
    'removeUrl': '/fileUploadService/remove',
    'autoUpload': true
  },

  cancel: function () {
    console.log('Cancel Event.');
  },

  complete: function () {
    console.log('Complete Event....