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

Disable Drop Zone

2 Answers 468 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Raghu
Top achievements
Rank 1
Raghu asked on 04 May 2017, 09:34 AM

Hi,

My requirement is to allow user to upload only one file at a time. But looks like Kendo hasn't got an out of box solution to this. 'Select files..' button is active after user has uploaded a file and it allows further any number of uploads and the same is with drop zone.

It is disappointing that the 'multiple:false' doesn't work if I use the 'upload' event. So I had to do a workaround to this such that user can select only one file.

Now my problem is to disable drop zone after user has uploaded one file. This seems to be very difficult to get it working. so I concluded to disable the drop zone completely as I am happy with the 'Select' button.

In this saga I found this thread http://www.telerik.com/forums/disable-drag-drop#2293863 and tried to use this line 'kendo.ui.Upload.fn._supportsDrop = function() { return false; }' exactly as stated in the thread. But it never worked and resulted with a javascript error on my console window. Please see the attached screenshot for the error and my code snippet.

Please help me how to disable the drop zone completely

PS: I am using this Upload control in an MVC project & using Kendo 2017 version

2 Answers, 1 is accepted

Sort by
0
Raghu
Top achievements
Rank 1
answered on 04 May 2017, 09:55 AM

I can say, this issue is fixed now. I am able to disable the drag & drop feature completely. It is a syntax error, my bad.

The syntactical error is, I haven't placed a semi-colon after this line 'kendo.ui.Upload.fn._supportsDrop = function () { return false; }' because it is not there in the author's example, refer to below link please.

http://jsbin.com/feyelakibu/edit?html,output (Taken from this thread http://www.telerik.com/forums/disable-drag-drop#2293863)

But I can confirm, after placing a semi-colon right after the above stated line, drop zone is gone completely which is what I expected to be.

 

Thanks,

Raghu

0
Raghu
Top achievements
Rank 1
answered on 04 May 2017, 10:00 AM

I can confirm, this issue is fixed now. It is a syntax error, my bad.

The syntactical error is, I did not put a semi-colon after this line of code 'kendo.ui.Upload.fn._supportsDrop = function () { return false; }' because the author in the example (refer below link) did not have  this semi-colon

http://jsbin.com/feyelakibu/edit?html,output (taken from http://www.telerik.com/forums/disable-drag-drop#2293863)

So the bottom line is , I am successfully able to disable the drop zone by placing a semi-colon after the line of code stated above.

Thanks,

Raghu

Tags
Upload
Asked by
Raghu
Top achievements
Rank 1
Answers by
Raghu
Top achievements
Rank 1
Share this question
or