Upload didn't work in IE9 (access denied error)

2 posts, 0 answers
  1. Hans
    Hans avatar
    28 posts
    Member since:
    Mar 2011

    Posted 27 Aug 2013 Link to this post

    Hello. 
    I try to use following code:
    <html lang="en" class="no-js k-webkit k-webkit28">
    <head>
        <meta charset="utf-8">
        <title>TEST page</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" type="text/css" href="kendo.common.min.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="kendo.metro.min.css" media="screen" />
    <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    <script type="text/JavaScript" src="kendo.web.js"></script>
    <script>
        $( document ).ready(function() {
            var emailBody = new kendo.ui.Editor(
                document.getElementById('emailBodyNew'),
                {
                    tools: [
                        "bold",
                        "italic",
                        "underline",
                        "strikethrough",
                        "fontName",
                        "fontSize",
                        "foreColor"],
                }
            );

    var fileUpload = new kendo.ui.Upload($("#attachmentUpload"), {
                    async: {
                        saveUrl: "Email/UploadAttachment",
                        autoUpload: true
                    },
                    multiple: true,
                    showFileList: false,
                    success: function (model)
                    {
                        finshAttachmentLoading(model.response);
                    },
                    error: function (error)
                    {
                        console.log(error);
                    },
                    upload: function(e)
                    {
                        console.log(e);
                    },
                    localization:
                        {
                            dropFilesHere: "Put files here"
                        }
                });

    $("#testbutton").on("click", function () { 
    $("attachmentUpload").click();});
    });
        </script>
    </head>
    <body>
    <div class="email-body">
    <textarea id="emailBodyNew"></textarea>
    <div class="upload-attachments-wrapper">
    <input type="file" id="attachmentUpload" name="fileUpload" />
    <button id="testbutton">Click me</button>
    </div>
    </div>
    </body>
    </html>

    But IE9 showed me always  Access Denied error on line with following code: form[0].submit(); (method performUpload).
    What should I need to change to fix this problem?
  2. T. Tsonev
    Admin
    T. Tsonev avatar
    2770 posts

    Posted 27 Aug 2013 Link to this post

    Hello,

    This is a security feature of IE - the file can be selected only by directly clicking on the upload. Triggering a "click" event with JavaScript will lead to the exception at the time of the upload.

    Our recommendation is to apply any styling to the Upload directly and to let it handle the click event.

    I hope this helps.

    Regards,
    T. Tsonev
    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