论坛首页 Web前端技术论坛

uploadify时而能上传,时而不能上传,求解答

浏览 2307 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2015-08-04  
困扰好几天的问题了,uploadify刚开始是能用的,但是不知道是点击频繁还是咋回事,上传几次,再进行上传就没有反应了,完之后换火狐浏览器也是刚开始可以,但是进行一两次上传就跟IE一样,再不能上传了,而且内存中显示Java相关协议疯狂的占CPU,不知道是什么原因,困扰了好几天,网上也找了好多相关的方法,发现并没有用,各位大神求解答啊。
下面是我的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>&nbsp;    
        <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>
论坛首页 Web前端技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics