AjaxFileUpload(2)Trouble Shooting
AjaxFileUpload(2)TroubleShooting
AccessisDenied
Mostbrowserspreventsubmittingfileswhentheinputfielddidn'treceiveadirectclick(orkeyboard)eventasasecurityprecaution.Somebrowsers(e.g.GoogleChrome)simplypreventtheclickevent,whilee.g.InternetExplorerdoesn'tsubmitanyfilesthathavebeenselectedbyaprogrammaticallytriggeredfileinputfield.
Firefox4(andlater)issofartheonlybrowserwithfullsupportforinvoking"click"-Eventsonacompletelyhidden(display:none)fileinputfield.
Thisistheproblemforajaxfileuploadandjqueryfileuploadfrommyunderstanding.
solution:
Iwillchecktheversionofbrowser,iftheydonotsupportthatsecurityprecaution,Iwillusedirectlyclick.
privatebooleanisIE(HttpServletRequestrequest){
logger.info("useragent="+request.getHeader("USER-AGENT").toLowerCase());
returnrequest.getHeader("USER-AGENT").toLowerCase().indexOf("msie")>0?true
:false;
}
<!--[ifIE]>
<style>
#filemaps{display:block;}
formlabel{float:left;}
</style>
<![endif]-->
DownlaodtheIEmultipleversionsfromhere:
http://dl.dbank.com/c0ixfbqjep
http://stackoverflow.com/questions/5276653/jquery-trim-ie-browser-compatibility-question
Trychanging:
visiblePara.text().trim().length
to:
$.trim(visiblePara.text()).length
forIE8
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
相关推荐
为了美观,把 type="file" 控件隐藏。点击“上传”按钮,click调用隐藏文件控件,再选择文件。查了一遍,好像是ie为了安全控制,文件的必须鼠标点击过后,才能提交。还没有想到其他的方法。。。
5,success 提交成功后自动执行的处理函数,参数data就是服务器返回的数据。6,error 提交失败自动执行的处理函数。7,data 自定义参数。fileElementId: 'file1',