IE10 SCRIPT5: Access is denied. on new FormData
Asked Answered
A

2

5

This works in the latest version of Chrome and Firefox, however in IE10 I get this error:

SCRIPT5: Access is denied.

Here is my code snippet:

 $('.mlsUpload').change(function () {
var formData = new FormData($(this).parents('form')[0]);
});

It happens on the new FormData($(this).parents('form')[0])

The change is on a display:none input type=file, which is the only thing in the form.

Apfelstadt answered 22/8, 2013 at 19:46 Comment(2)
It seems IE 10 limits access to the local storage if the site is not among trusted. Can you disable the protected mode and see?Offering
@Offering I disabled protected mode and am still having the error.Apfelstadt
A
9

I'm not entirely sure on why but this code seems to have fixed the issue and works on all browsers.

var formData = new FormData();            
var inputFiles = $("#idOfInput").get(0);
formData.append('file', inputFiles.files[0]);
Apfelstadt answered 22/8, 2013 at 22:4 Comment(1)
Worked for me and I didn't have to change display from none or use a label tag.Pudency
M
2

IE10 restrict submission of file field if the field is with 'display:node'. If you remove the display:none the first fragment of code should work. However I'm not sure how to workaround this and why it works in second example.

Matronymic answered 19/12, 2013 at 14:49 Comment(1)
This is happening in IE10, not 8. The input also needs to be hidden in some fashion or another in my case.Apfelstadt

© 2022 - 2024 — McMap. All rights reserved.