浏览 2307 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2015-08-04
下面是我的JSP代码: <%@ page language="java" pageEncoding="gbk"%> <% String path = request.getContextPath(); String id = request.getParameter("empid"); if(id == null || id.length() ==0){return;} request. setCharacterEncoding("GBK"); %> <!DOCTYPE html PUBLIC "-//W3C//dtd XHTML 1.0 Strict//en" "http://www.w3. org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <head> <title>文件批量上传</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <link href="<%=path%>/css/default.css" rel="stylesheet" type="text/css" /> <link href="<%=path%>/css/uploadify.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="<%=path%>/js/jquery-1.3.2.min.js"></script> <script type="text/javascript"src="<%=path%>/artDialog/artDialog.js?skin=blue"></script> <script type="text/javascript" src="<%=path%>/artDialog/plugins/iframeTools.js" ></script> <script type="text/javascript" src="<%=path%>/js/swfobject.js"></script> <script type="text/javascript" src="<%=path%>/js/jquery.uploadify.v2.1.4.js"></script> <script type="text/javascript" src="<%=path%>/js/jquery.uploadify.v2.1.4.min.js"></script> <script type="text/javascript" src="<%=path%>/js/simr-jquery.js" ></script> <script type="text/javascript"> $(document).ready(function() { $("#uploadify").uploadify({ 'uploader' : '<%=path%>/js/uploadify.swf', 'script' : '<%=path%>/FileUploadServlet', 'cancelImg' : 'images/cancel.png', 'height' : 30, 'width' : 120, 'folder' : 'uploads', 'queueID' : 'fileQueue', 'fileDesc' : '请选择doc,docx,xls,xlsx文件', 'fileExt' : '*.doc;*.docx;*.xls;*.xlsx', 'sizeLimit' : 1024*1024*100, 'auto' : false, 'multi' : true, 'simUploadLimit' : 5, 'buttonText' : 'UPLOAD', 'onComplete' : function(event,queueID,fileObj,resp,data){ var pathurl = resp; var path = pathurl.substring(pathurl.lastIndexOf('\WebRoot')); var name = pathurl.substring(pathurl.lastIndexOf('/')+1); alert(name); $("#urlid").val(path); $("#nameid").val(name); alert(pathurl); submitadd(); } }); }); </script> </head> <body> <div id="fileQueue" > <p><input type="file" name="uploadify" id="uploadify" /></p> <a href="javascript:$('#uploadify').uploadifyUpload()">开始上传</a> <a href="javascript:$('#uploadify').uploadifyClearQueue()">取消所有上传</a> <form id="FileAdd_Form" action="GRPFile_doAdd.action" method="post" target="resultIframe"> <input type="hidden" name="successurl" value="/include/actionresult.jsp" /> <input type="hidden" name="inputurl" value="/include/actionresult.jsp" /> <input type="hidden" name="id" value="<%=id %>" /> <input type="hidden" name="Urls" id="urlid" value="" /> <input type="hidden" name="names" id="nameid" value=""> </form> <iframe name="resultIframe" id="resultIframe" style="display: none"></iframe> </div> </body> <script type="text/javascript"> function submitadd(){ //alert(12345678); $("#FileAdd_Form").submit(); <%-- Urls:"<%=path%>/FileUploadServlet", alter(Urls), if(Urls != 'no'){ $("#urlid").val(Urls); } --%> } //提交按钮并验证后执行,确保按钮不会被重复按 function submitfun(){ $("#addsubmit").attr("disabled", true); $("#btnreset").attr("disabled", true); $("#doLoading").show(); return true; } //操作完成回调执行函数 function resultfun(returnkey, returnvalue) { //alert(returnkey.startWith("s")); if (returnkey != null) { if (returnkey.startWith("s")) { art.dialog( {title : "提示",icon : 'succeed',content : returnvalue,time : 1}); setTimeout("this.location.href='empList.jsp'", 1000); } else { art.dialog( {id : 'failID',title : "警告",icon : 'warning',content : returnvalue,button : [ {name : '确定'} ]}); $("#addsubmit").attr("disabled",false); $("#btnreset").attr("disabled", false); $("#doLoading").hide(); } } } </script> <script> </script> 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |