getting access is denied error on IE8

≡放荡痞女 提交于 2019-11-26 14:34:15

IE doesn't allow manipulation of the type="file" input element from javascript due to security reasons. Setting the filename or invoking a click event to show the browser dialog will result in an "Access is denied" error on the form submit - Internet Explorer is clever about remembering what methods have been invoked.

Similar issue: http://www.webdeveloper.com/forum/showthread.php?t=181272

Rajat

Traditionally, JavaScript access to HTML input type="file" is severely limited for security concerns. AFAIK, You can't do the following with JS on a file uploader element:

  1. You cannot read the "value" of the element as it holds the filename.
  2. You can't fire up the file selection menu via JS.
  3. You can't fire submit of the file uploader control via JS.

All this is in place to prevent malicious attacks like stealing your files in background via JS. I haven't played with an input type="file" element in a while but my best guess is you will hit similar issues (if not all) in other browsers as well.

Your best bet is a Flash based solution or maybe some new HTML5 control.

Also, here is an official reference on the subject matter:

http://msdn.microsoft.com/en-us/library/ms535263(v=vs.85).aspx

Check "Community Content" all the way on the bottom of the above page.

Gaurav Saxena

In both the HTML files — the one which is in the frame and another which contains the frame — try adding document.domain='example.com' where 'example.com' is your domain name.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!