<mce:script type="text/javascript" src="../../js/lib/ext/adapter/jquery/jquery.js" mce_src="js/lib/ext/adapter/jquery/jquery.js"></mce:script> <mce:script type="text/javascript" src="../../js/infopriv/ajaxfileupload.js" mce_src="js/infopriv/ajaxfileupload.js"></mce:script> jsp: $(document).ready(function(){ $('.id_uploadFile').bind('change',function(){ var fileUrl = $(this).val(); $.ajaxFileUpload({ url : 'upload-much', secureuri:false, fileElementId:'upload', dataType : 'json', error : function(e){ }, success:function(result){ if(result.msg == 'success'){ $('.insert').removeAttr('disabled'); } if(result.msg == 'false'){ parent.Ext.Msg.alert('系统信息','上传的附件大于50M!'); $('.insert').attr('disabled','true'); } } }); }); <div class="cleft oneline"> 上传附件 <form method="post" action="upload-much" enctype="multipart/form-data"> <input type="file" id="upload" name="upload" class="id_uploadFile"/><span style="color: red">* 文件大小不要超过50M</span> </form> </div> action: @Action("upload-much") public String uploadMuch(){ upload = (File) request.getAttribute("upload"); logger.info(upload.length()); if(upload.length()>5242880){ fileDX = "{msg:'false'}"; }else{ fileDX = "{msg:'success'}"; } logger.info("timeStamp"+timeStamp); return "fileMuch"; }