Identify Files When Uploading

The internal implementation of the Upload widget allows you to identify which is the file object, that is being uploaded to the remote endpoint.

Identify Files

Regardless of the mode of operation, a unique identifier (uid) is generated for each file. In the case of a synchronous or asynchronous upload with the batch option enabled, the single uid that is generated, stands for the whole batch of files, selected at the same time. In the case of asynchronous upload with the batch option disabled, a uid is generated for each separate file.

The generated uid is added to all the below events as a property of the e.files collection:

Example
@(Html.Kendo().Upload()
    .Name("files")
    .Async(a => a
        .Save("Save", "Upload")
        .Remove("Remove", "Upload")
        .AutoUpload(true)
    )
    .Events(events => events
        .Select("onSelect")
    )
)

<script type="text/javascript">
    function onSelect(e) {
        console.log("Selected files uids :: [ " + getFileInfo(e) + " ]");
    }

    function getFileInfo(e) {
        return $.map(e.files, function(file) {
            var info = file.uid;

            return info;
        }).join(", ");
    }
</script>

See Also

In this article
Not finding the help you need? Improve this article