This is a migrated thread and some comments may be shown as answers.

Select Event Data Chrome Bug

1 Answer 78 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Dan Green
Top achievements
Rank 1
Dan Green asked on 09 Dec 2011, 09:23 PM
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();
    }
}

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 12 Dec 2011, 12:32 PM
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!
Tags
Upload
Asked by
Dan Green
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or