3

How submit a Kendo Upload file in async mode with a external button using javascript, it's possible? someone have a solution for this?

1 Answer 1

6

After initially selecting a file, KendoUpload will create a button you can select with $(".k-upload-selected"). Calling click on this button will POST back to your saveUrl setup in the async options. You will need to set autoUpload: false.

On select in kendUpload, you can access the Kendo generated upload button, hide it then trigger the click event in myUploadButton's click.

My original code was inside a Backbone view. Just to simplify I pulled it out. I haven’t tested the code below, however it should be fairly close to what you need.

        var myUploadButton = $("#save");        
        var kendoUploadButton;
        $("#files").kendoUpload({
            async: {
                saveUrl: http://uploadurl",
                autoUpload: false,
            },
            multiple: false,
            select: function (e) {

                setTimeout(function () {
                    kendoUploadButton = $(".k-upload-selected");
                    kendoUploadButton.hide();
                }, 1);
            }
        });

        myUploadButton.click(function() {
          if(kendoUploadButton)
              kendoUploadButton.click();
        });

Kendo Forum post on KendoUpload Trigger

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.