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

Manually Cancel Upload

4 Answers 305 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Dave Wolf
Top achievements
Rank 1
Iron
Dave Wolf asked on 21 Jan 2013, 05:40 PM
I'm using two upload controls for a multi file upload page.  If the browser isn't HTML5 compatible it changes to a flash uploader.  I wanted to create a consistent feel so I made my own custom progress area that looks the same for both.  I'm wondering if I can manually throw the cancel event for a file in progress.   Is there javascript I can call to cancel a file or do I have to use the built in file list area?

4 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 23 Jan 2013, 09:10 AM
Hi Dave,

Thank you for your question. There is no direct way to call the cancel event through the API, but I can suggest you a workaround though - you can manually trigger the click event of the cancel button of Kendo Upload. This code should work for you, if you put it in the progress event handler:

$(".k-file:has([title='" + e.files[0].name + "']) .k-cancel").click()

I hope this will work in your case.

Regards,
Dimiter Madjarov
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Daniele Bruno
Top achievements
Rank 1
answered on 08 Jan 2015, 09:36 AM
Hi Dimiter,

your solution works in Chrome, FF and Safari, but in IE8   it only Remove  file from File list, but the HTTP request is not cancelled, so the server receives the file.
Do you have a workaround or another solution for IE8 ?
0
Daniele Bruno
Top achievements
Rank 1
answered on 08 Jan 2015, 09:39 AM
Hi Dimiter,
your solution works in Chrome, FF and Safari but in IE8 it olny remove the file from file List, but the http request is not canceled and the server receives the file.
Do you have a workaround or another solution for IE8?

0
Dimiter Madjarov
Telerik team
answered on 09 Jan 2015, 08:08 AM

Hello Daniele,

The reason for this behavior is that the progress event is not fired in old Internet Explorer versions. Basically you could use the same approach, but not in the progress event handler - trigger the click of the cancel button.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Upload
Asked by
Dave Wolf
Top achievements
Rank 1
Iron
Answers by
Dimiter Madjarov
Telerik team
Daniele Bruno
Top achievements
Rank 1
Share this question
or