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

Drag & Drop File Upload

4 Answers 427 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Colin
Top achievements
Rank 1
Colin asked on 14 Jun 2012, 03:09 PM

I have been unable to initialize the drag and drop feature for file upload on any of my browsers.  I am currently testing on Chrome 19.0.1084.56 m.  Is there an undocumented configuration parameter I am missing which will initialize this feature?  

Here is my code, please let me know if you see anything I have configured improperly.

HTML:

<div class="fileUploadContentArea">
<input name="file" id="kendoFileUpload" type="file" />
</div>

JS:

 $("#kendoFileUpload").kendoUpload({
  multiple: true,
        select: context.onFileSelected,
async: {
saveUrl: THX.WS.config.baseUrl + THX.WS.config.wsId + '/files',                        
autoUpload: true
},
upload: context.kendoFileUploaderDrop,
success: context.kendoFileUploaderDone,
error: context.kendoFileUploaderError,
showFileList : false,
localization : {
select : libraryAssetsLocalizedStrings.mainUploadSelectLabel,
dropFilesHere : libraryAssetsLocalizedStrings.mainUploadDragDropLabel
}
});

4 Answers, 1 is accepted

Sort by
0
Colin
Top achievements
Rank 1
answered on 19 Jun 2012, 12:22 PM
At the very least has anyone got the drag and drop feature of file upload to work on their system?
0
Mark Dawson
Top achievements
Rank 1
answered on 20 Jun 2012, 07:13 AM
Hi Colin,

I have gotten this to work but it required editing the kendo files.

There is a part of the upload component that relies on browser (userAgent) detection and modifies it's behaviour accordingly. One of the things modified is the drag and drop capabilities.

In kendo.web.js and kendo.upload.js (if you have source files available), you'll find the following:
_supportsFormData: function() {
    if ($.browser.safari) {
        return false;
    }
 
    return typeof(FormData) != "undefined";
},

Removing the first three lines has so far worked fine for me but I've not tested it to any level. There may be unwanted side effects that I've not yet seen - it's working in Chrome but I've not fired up Safari. As feature detection is still present and the drag/drop part does further browser checks, I'm reasonably confident those lines are not needed.

$.browser.safari will return true on any webkit based browser and $.browser is deprecated.

Regards,
Mark.
0
Colin
Top achievements
Rank 1
answered on 21 Jun 2012, 05:06 PM
Mark,

 Prefect, that did the trick! Drag and drop is now working like a charm.  Does the Kendo team know about this issue?  I would mark this as an answer, but since it requires changing the base code, I'll leave that alone. 

Thanks again!
Colin
0
Devi
Top achievements
Rank 1
answered on 12 Nov 2012, 11:53 AM
thanks that helped
Tags
Upload
Asked by
Colin
Top achievements
Rank 1
Answers by
Colin
Top achievements
Rank 1
Mark Dawson
Top achievements
Rank 1
Devi
Top achievements
Rank 1
Share this question
or