AjaxFileUpload(2)Trouble Shooting

本文探讨了使用Ajax进行文件上传时遇到的“Access is Denied”问题,并针对不同浏览器的安全限制提供了解决方案,特别是如何处理Internet Explorer的兼容性问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

AjaxFileUpload(2)Trouble Shooting

Access is Denied
Most browsers prevent submitting files when the input field didn't receive a direct click (or keyboard) event as a security precaution. Some browsers (e.g. Google Chrome) simply prevent the click event, while e.g. Internet Explorer doesn't submit any files that have been selected by a programmatically triggered file input field.
Firefox 4 (and later) is so far the only browser with full support for invoking "click"-Events on a completely hidden (display: none) file input field.

This is the problem for ajaxfileupload and jqueryfileupload from my understanding.

solution:
I will check the version of browser, if they do not support that security precaution, I will use directly click.

private boolean isIE(HttpServletRequest request) {
logger.info("useragent = " + request.getHeader("USER-AGENT").toLowerCase());
return request.getHeader("USER-AGENT").toLowerCase().indexOf("msie") > 0 ? true
: false;
}

<!--[if IE]>
<style>
#filemaps{ display:block ;}
form label {float:left;}
</style>
<![endif]-->

Downlaod the IE multiple versions from here:
http://dl.dbank.com/c0ixfbqjep

http://stackoverflow.com/questions/5276653/jquery-trim-ie-browser-compatibility-question

Try changing:

visiblePara.text().trim().length

to:

$.trim(visiblePara.text()).length

for IE8

references:
http://stackoverflow.com/questions/10504945/javascript-exception-uncaught-typeerror-converting-circular-structure-to-json
http://stackoverflow.com/questions/210643/in-javascript-can-i-make-a-click-event-fire-programmatically-for-a-file-input

http://stackoverflow.com/questions/10482265/js-submit-access-denied-iframe-ie

http://stackoverflow.com/questions/2276374/access-is-denied-when-script-tries-to-access-iframe-in-ie8
http://www.webdeveloper.com/forum/showthread.php?t=181272
http://stackoverflow.com/questions/3935001/getting-access-is-denied-error-on-ie8
http://my.opera.com/justnewbee/blog/ajaxuplod-accessibility-ie-access-denied
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值