Manually Cancel Upload

5 posts, 0 answers
  1. Dave Wolf
    Dave Wolf avatar
    33 posts
    Member since:
    Feb 2006

    Posted 21 Jan 2013 Link to this post

    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?
  2. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 23 Jan 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 08 Jan 2015 in reply to Dimiter Madjarov Link to this post

    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 ?
  5. Daniele Bruno
    Daniele Bruno avatar
    22 posts
    Member since:
    Apr 2009

    Posted 08 Jan 2015 in reply to Dimiter Madjarov Link to this post

    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?

  6. Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2156 posts

    Posted 09 Jan 2015 Link to this post

    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!
     
Back to Top
Kendo UI is VS 2017 Ready