uploadify_302錯誤


1、錯誤原由:

  

 

  controller類有根據sessionId判斷當前是否已經登陸過,當沒有sessionId或者sessionId輸入的值錯誤,就會調回登錄界面,報出的錯誤代碼為:302

2、查看:可以根據uploadify 的onError方法中的參數:errorObj(type和info),可以查看到對應的錯誤信息

3、解決方法:將當前的sessionId參數攜帶到URL中即可:

   script: '/upload.do;jsessionid=<%=session.getId()%'

4、代碼:

  

function getUpload() { 
        var buttonImg = $_frontPath+'/images/ny/add.png'; 
        $("#uploadify").uploadify({  
            'uploader'       : '<%=basePath %>/uploadify/scripts/uploadify.swf',
            'script'         : '<%=path %>${ADMIN_URL }/upload/uploadFiles;jsessionid=<%=session.getId()%>',  
            'cancelImg'      : '<%=basePath %>/uploadify/cancel.png',
            'buttonImg'      : buttonImg,  
            'queueID'        : 'fileQueue',  
            'auto'           : true,  
            'multi'          : true,  
            'wmode'          : 'transparent',  
            'simUploadLimit' : 999,  
            'fileExt'        : '*.png;*.gif;*.jpg;*.jpeg',  
            'fileDesc'       : '*.png,*.gif,*.jpg,*.jpeg', 
            'onError': function(e, queueId, fileObj,errorObj){
                alert("類型:" + errorObj.type + "\r\n" +
                      "錯誤信息:" + errorObj.info + "\r\n" 
                )},    
               
            'onComplete'  :function(event,queueId,fileObj,response,data){
                indx++;
                var retJson = eval(response)[0];
                /*$("#fileUL").append("<li  id='li_"+indx+"'> <img src='<%=path %>"+retJson.filepath+"' style='width: 200px;height: 200px;' ></img>"
                +"<input type='hidden' name='borrowPicture' type='text' value='"+retJson.filepath+"' ></input>"
                +"&nbsp;&nbsp;&nbsp;<a href=\"javaScript:delet('li_"+indx+"')\" >刪除</a>"
                +"</li>");*/
                
            }  
        }); 
    };

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM