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

Uploading files to the server asynchronously


In this recipe, we will take a look at uploading files asynchronously to the server. This method uses the HTML5 File API to upload the files to the server. While the files are being uploaded, the progress of the file upload is shown in the uploader widget.

Getting started

This recipe will require server-side handlers that can store or remove files.

How to do it…

Let's use the same form to upload the files to the server. To upload the files asynchronously, specify the async configuration:

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

Here, the async configuration specifies the three attributes: saveUrl, removeUrl, and autoUpload. The saveUrl property specifies the service URL where the files will be uploaded. The removeUrl property specifies the service URL that will handle the removal of the uploaded files. The Boolean autoUpload property...