success

Fires when an upload or remove operation is completed successfully.

  • The success event fires only when the Upload is in async mode.
  • It is possible to cancel the event. As a result, the file is displayed as uploaded unsuccessfully.

Example

<input type="file" name="files" id="photos" />
<script>
    $("#photos").kendoUpload({
        async: {
            saveUrl: "http://my-app.localhost/save",
            removeUrl: "http://my-app.localhost/remove"
        },
        success: onSuccess
    });

    function onSuccess(e) {
        // An array with information about the uploaded files
        var files = e.files;

        if (e.operation == "upload") {
            alert("Successfully uploaded " + files.length + " files");
        }
    }
</script>

Event Data

e.files Array

A list of the files that are uploaded or removed.

Each file has:

  • name
  • extension - The file extension including the leading dot. For example, .jpg, .png, and so on.
  • size - The file size in bytes. If not available, the value is null.
  • uid - The unique identifier of the file or batch of files.
e.operation String

The upload or remove operation.

e.response Object

The response object that is returned by the server.

e.XMLHttpRequest Object

Represents either the original XHR that is used for the operation or a stub that contains:

  • responseText
  • status
  • statusText

Before you access any other fields, verify that this is an actual XHR.

In this article