Check if Upload Initialized

3 posts, 0 answers
  1. shimmoril
    shimmoril avatar
    113 posts
    Member since:
    Jun 2012

    Posted 12 Nov 2015 Link to this post

    Is there any way to programmatically check if an upload widget has been initialized?

    I've got a bit of an odd situation, where the same child upload can be associated with multiple parents on the page and I'm trying to set the file list on page load. Since the child exists twice, the (single) file is being displayed twice on each of the two widgets. 

    I'm using a class to target the children items to add an upload, since they have the same ID:

    <input class="upload-#= data.Items[i].ID #" type="file" />

    Then when I init the upload, I'm creating a files array:

    for (var i = 0; i < data.Items.length; i++) {      
        var files = [];
        for (var a = 0; a < data.Items[i].Attachments.length; a++) {                       
                name: data.Items[i].Attachments[a].Name,
                size: data.Items[i].Attachments[a].Size,
                extension: data.Items[i].Attachments[a].Extension
        $('.rcr-upload-' + data.Items[i].ID).kendoUpload({
            multiple: true,
            async: {
                saveUrl: "/controllers/UploadController.cfc?method=upload",
                autoUpload: true
            files: files

    When I console.log the files array, it only has the one item in it, so it looks like the duplication is happening because the inputs have the same class (which again, is because the ID is the same). There's no unique ID I can provide for these items, so I'm hoping to check if the widget has been init'd instead.

  2. Dimiter Madjarov
    Dimiter Madjarov avatar
    2122 posts

    Posted 13 Nov 2015 Link to this post

    Hello shimmoril,

    In order to check whether the widget is initialized, you could retrieve the Upload widget instance object

    var upload = $(...).data("kendoUpload");
    and check if it returns the actual object and not undefined.

    Dimiter Madjarov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. shimmoril
    shimmoril avatar
    113 posts
    Member since:
    Jun 2012

    Posted 16 Nov 2015 in reply to Dimiter Madjarov Link to this post

Back to Top