Allow user to remove files before upload, but not after

2 posts, 1 answers
  1. Josh
    Josh avatar
    72 posts
    Member since:
    Jun 2013

    Posted 27 Jul 2013 Link to this post

    I have the following config:
    $("#upload-file").kendoUpload({
                async: {
                    saveUrl: "http://mysite.com/upload",
                    removeUrl: "remove",
                    autoUpload: false
                }
            });
    I would like to have the remove buttons on all the files before the user uploads the files (so they can remove any that were accidentally selected). I do not want to provide a remove button after the files have been uploaded because we are not currently supporting removal of files after they are uploaded.

    I see that removing the "removeUrl" setting removes the ability to remove files all together. Is there a way to configure the control the way I describe?
  2. Answer
    Dimiter Madjarov
    Admin
    Dimiter Madjarov avatar
    2153 posts

    Posted 29 Jul 2013 Link to this post

    Hello Joshua,


    A sample approach, that could be used to achieve this is to bind to success event and manually remove the button, when files are uploaded.
    E.g.
    function success(e) {
        if (e.operation == "upload") {
            var that = this;
            setTimeout(function () {
                $(that.wrapper).find("li.k-file-success .k-upload-action")
                               .css("visibility", "hidden");
            });
        }
    }

     

    Regards,
    Dimiter Madjarov
    Telerik
    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
Back to Top