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

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

1 Answer 118 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Hans
Top achievements
Rank 1
Hans asked on 27 Aug 2013, 11:50 AM
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?

1 Answer, 1 is accepted

Sort by
0
T. Tsonev
Telerik team
answered on 27 Aug 2013, 12:48 PM
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!
Tags
Upload
Asked by
Hans
Top achievements
Rank 1
Answers by
T. Tsonev
Telerik team
Share this question
or