AjaxFileUpload(2)Trouble Shooting

WillZhang 2012-07-09

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

相关推荐