日期:2014-05-20 浏览次数:20655 次
<script type="text/javascript" src="./js/jquery.js"></script> <script type="text/javascript" src="./js/ajaxfileupload.js"></script> <script type="text/javascript"> function FileUpload() { $.ajaxFileUpload ( { url:'fileupload.action', secureuri:false, fileElementId:'upload', dataType: 'json', success: function (data, status) { if(typeof(data.error) != 'undefined') { if(data.error != '') { alert(data.error); }else { alert(data.msg); } } }, error: function (data, status, e) { alert(e); } } ) return false; } </script>
<struts> <package name="FileUploadAction" extends="json-default"> <action name="fileupload" class="fileUploadAction"> <param name="savePath">/userfiles/image</param> <result type="json"></result> </action> </package> </struts>