Select Event Data Chrome Bug

2 posts, 0 answers
  1. Dan Green
    Dan Green avatar
    4 posts
    Member since:
    Mar 2008

    Posted 09 Dec 2011 Link to this post

    I have the upload widget setup in async mode and have specified a Select event function for validation of the selected file type.
    Everything works in FF and IE, but in chrome v15.0.874.121 the event data object passed into the select event method is different from the documentation when a file is dragged and dropped.

    Here is the object that is passes when the Select button is clicked and a file is selected in chrome, FF, and IE or drag and dropped in FF.
    e.files
    [
    Object
    extension: ".gif"
    name: "DiscMen.gif"
    rawFile: File
    size: 18578
    __proto__: Object

    Here  is the object that is passed when a file is dragged and dropped on the drop zone in Chrome.
    e.files
    FileList
    0: File
    fileName: "DiscMen.gif"
    fileSize: 18578
    lastModifiedDate: Date
    name: "DiscMen.gif"
    size: 18578
    type: "image/gif"
    webkitRelativePath: ""
    __proto__: File
    length: 1
    __proto__: FileList   

    my html:
    <input name="files" id="files" type="file" />
    my Script:
    $("#files").kendoUpload({
                            showFileList: false,
                            multiple: false,
                            select: onFileSelected,
                            async: {
                                saveUrl: Site.RootUrl + "Account/UploadAvatar",
                                saveField: "avatarFile",
                                autoUpload: true
                            },
                            localization: {
                                "select": Site.GlobalResources.Account_Settings_Upload_Avatar_Select_Button,
                                "dropFilesHere": Site.GlobalResources.Account_Settings_Upload_Avatar_Drop_Zone_Message
                            }
                        });
    function onFileSelected(e) {
        if (e.files[0].extension  != '.jpg') {
            e.preventDefault();
        }
    }
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2831 posts

    Posted 12 Dec 2011 Link to this post

    Hi Dan,

    Thank you for reporting this problem. I've sent a fixed build in your support ticket.

    The fix will be available in the SP1 release as well.

    Regards,
    Tsvetomir Tsonev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top