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

Reset upload.

8 Answers 496 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Juan
Top achievements
Rank 1
Juan asked on 28 Nov 2011, 10:12 PM
Is there any way to reset the upload form without the control firing the remove event on previously uploaded files?

8 Answers, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 01 Dec 2011, 04:54 PM
Hello Juan,

The only way to do that at the moment is to remove the elements from the DOM directly:

$("#attachments").parents(".t-upload").find(".t-upload-files").remove()

The current behavior is very questionable - the reset should not send any information to the server. We'll change it to simply clean the file list. Removing all files can be done via a removeAll() method, for example.

Thank you for bringing this question up. As a token of gratitude for your involvement your Telerik points have been updated.
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!
0
Vishwa
Top achievements
Rank 1
answered on 21 Jan 2012, 08:18 PM
I have (temporarily) called : $(".k-upload-files").remove(); to reset the list of the selected files.  Work for well for me.
0
Daniel
Top achievements
Rank 1
answered on 17 Apr 2014, 08:45 AM
I need this behavior too! This should be build into upload widget!

Regards,
Daniel

BTW: The workaround mentioned by T.Tsonev works for me (but this should not be the right way to do it)
0
Dimiter Madjarov
Telerik team
answered on 17 Apr 2014, 10:03 AM
Hi Daniel,

Thank you for the suggestion. I'll pass it to the development team for discussion if this functionality should be added out of the box. Meanwhile you could also post it as a suggestion in our Feedback portal or vote for it if it's already there.


Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Mac
Top achievements
Rank 2
answered on 13 May 2014, 12:44 PM
+1 for fixing this.

0
Dimiter Madjarov
Telerik team
answered on 13 May 2014, 02:43 PM
Hello Scott,


As stated in the previous post, you could post this as a suggestion in our Feedback portal. I checked and it seems that this has not been posted yet.

In the mean time, you could use the workaround from the previous post.

Regards,
Dimiter Madjarov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Brandon Peterson
Top achievements
Rank 2
answered on 05 Jun 2014, 02:20 AM
Here is a function that I added in my general UI class to do this. Works with v2014.1.318

uploadReset: function(id) {
    if (id) {
        //if an id is passed as a param, only reset the element's child upload controls (in case many upload widgets exist)
        $("#" + id + " .k-upload-files").remove();
        $("#" + id + " .k-upload-status").remove();
        $("#" + id + " .k-upload.k-header").addClass("k-upload-empty");
        $("#" + id + " .k-upload-button").removeClass("k-state-focused");
    } else {
        //reset all the upload things!
        $(".k-upload-files").remove();
        $(".k-upload-status").remove();
        $(".k-upload.k-header").addClass("k-upload-empty");
        $(".k-upload-button").removeClass("k-state-focused");
    }
}
0
Dimiter Madjarov
Telerik team
answered on 05 Jun 2014, 06:21 AM
Hi Brandon,


Thank you for sharing the sample code.

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
Juan
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Vishwa
Top achievements
Rank 1
Daniel
Top achievements
Rank 1
Dimiter Madjarov
Telerik team
Mac
Top achievements
Rank 2
Brandon Peterson
Top achievements
Rank 2
Share this question
or