Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE10 SCRIPT5: Access is denied. on new FormData

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.

like image 352
Kyle Avatar asked Aug 22 '13 19:08

Kyle


2 Answers

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]);
like image 104
Kyle Avatar answered Oct 16 '22 21:10

Kyle


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.

like image 2
user3119605 Avatar answered Oct 16 '22 22:10

user3119605