Note: The cancel event fires only when the upload is in async mode.
$("#photos").kendoUpload({
// ...
cancel: onCancel
});
function onCancel(e) {
// Array with information about the uploaded files
var files = e.files;
// Process the Cancel event
}files
: Array
Note: The complete event fires only when the upload is in async mode.
$("#photos").kendoUpload({
// ...
complete: onComplete
});
function onComplete(e) {
// The upload is now idle
}Note: The error event fires only when the upload is in async mode.
$("#photos").kendoUpload({
// ...
error: onError
});
function onError(e) {
// Array with information about the uploaded files
var files = e.files;
if (e.operation == "upload") {
alert("Failed to uploaded " + files.length + " files");
}
// Suppress the default error message
e.preventDefault();
}files
: Array
operation
: String
XMLHttpRequest
: Object
$("#photos").kendoUpload({
// ...
remove: onRemove
});
function onRemove(e) {
// Array with information about the removed files
var files = e.files;
// Process the Remove event
// Optionally cancel the remove operation by calling
// e.preventDefault()
}files
: Array
data
: Object
var onSelect = function(e) {
$.each(e.files, function(index, value) {
console.log("Name: " + value.name);
console.log("Size: " + value.size + " bytes");
console.log("Extension: " + value.extension);
});
};
// initialize and configure an Upload widget with a select event handler
$("#photos").kendoUpload({
// ...
select: onSelect
});files
: Array
Note: The success event fires only when the upload is in async mode.
$("#photos").kendoUpload({
// ...
success: onSuccess
});
function onSuccess(e) {
// Array with information about the uploaded files
var files = e.files;
if (e.operation == "upload") {
alert("Successfully uploaded " + files.length + " files");
}
}files
: Array
operation
: String
response
: String
XMLHttpRequest
: Object
Note: The upload event fires only when the upload is in async mode.
$("#photos").kendoUpload({
// ...
upload: onUpload
});
function onUpload(e) {
// Array with information about the uploaded files
var files = e.files;
// Check the extension of each file and abort the upload if it is not .jpg
$.each(files, function() {
if (this.extension != ".jpg") {
alert("Only .jpg files can be uploaded")
e.preventDefault();
}
});
}files
: Array
data
: Object