0

I am submitting a form from javascript and it is giving error at form.submit().

HTML:

<form >
    <input type="file" name="filetype" onchange="uploadFile(this.form);" name="file" />
</form>

JS:

function uploadFile(form){
   var iframe = document.createElement("iframe");
   iframe.setAttribute("id", "upload_iframe");
   iframe.setAttribute("name", "upload_iframe");
   form.parentNode.appendChild(iframe);
   form.setAttribute("target", "upload_iframe");
   form.setAttribute("action", "abcd.do");
   form.setAttribute("method", "post");
   form.setAttribute("enctype", "multipart/form-data");
   form.setAttribute("encoding", "multipart/form-data"); 
   form.submit(); /// error is here (SCRIPT5: Access denied)
}

I have tried putting iframe's source as a file in same domain but that too didn't work. This is working very wekk in MOZILLA but giving described error in IE.

Dineshkani
  • 2,899
  • 7
  • 31
  • 43
Amit Sharma
  • 1,202
  • 11
  • 26
  • 2
    possible duplicate of [SCRIPT5: Access is denied in IE9 on file upload](http://stackoverflow.com/questions/6138859/script5-access-is-denied-in-ie9-on-file-upload) – epascarello Jun 07 '13 at 05:02
  • hi I have already tried putting source of iframe to an existing small html as i explained but didn't work for me – Amit Sharma Jun 07 '13 at 05:23
  • even getting the same error using ajaxSubmit jQuery library – Amit Sharma Jun 07 '13 at 08:09

0 Answers0