I am using the Kendo UI Upload control with the Knockout-Kendo.js project's binders. I have a file upload control on my form and am seeking to upload the file through the ajax callback provided by the Knockout-Kendo.js api. Most of the time, the upload goes through successfully, but every once in a while, so far only on IE, there's an issue and I get a javascript error saying "SCRIPT5: Access is denied." I've read that IE9 has security rules that can cause this error in certain situations, but I do not understand well enough how the kendo ui control works (or how the knockout-kendo library works) to understand what I might need to change to prevent the error. Any ideas will be very much appreciated!
Here is a simplified version of my code:
In the view:
In the javascript viewmodel:
In the MVC controller:
Here is a simplified version of my code:
In the view:
<input name="fileUpload" type="file" id="fileUpload" data-bind="kendoUpload: $root.fileUploadSettings()" />In the javascript viewmodel:
var fileCategory = "myCategory";fileUploadSettings = function () { var kendoSettings = { multiple: false, enabled: true, async: { saveUrl: "../Entity/AddFiles" }, success: function (e) { _uploadFileSuccess(e, fileCategory); }, error: function (e) { _uploadFileError(e, fileCategory); }, select: function (e) { _uploadFile(e, fileCategory); }, localization: { select: "Upload File" }, };[HttpPost]public ActionResult AddFiles(File data, System.Web.HttpPostedFileBase fileUpload){ try { File file = FileUIService.AddFile(data, fileUpload); FileView rfv = new FileView() { Id = file.Id, Name = fileUpload.FileName.Substring(fileUpload.FileName.LastIndexOf('\\') + 1) }; return Json(rfv, "text/plain"); } catch (Exception ex) { return Json(ex.Message, "text/plain"); }}