uploadify插件使用

原创
2016/04/21 14:02
阅读数 113
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";		
	String cssPath = basePath + "resource/theme/default/" +language + "/newcss/";
	String scriptPath = basePath + "resource/script/";	
%>
<!--uploadify上传组件  -->
<script type="text/javascript" src="<%=scriptPath%>plugins/uploadify/jquery.uploadify.min.js"></script><link href="<%=scriptPath%>plugins/uploadify/uploadify.css" rel="stylesheet" type="text/css"></link>
<input type="file" id="uploadBtn" />
<div id='queuelist' style = "width:500px;margin-left:250px;"></div>
$("#uploadBtn").uploadify({
		    width		  : 130,
		    height		  : 35,
		    buttonText    : '<s:text name="uploadMySource"/>',
		    swf           : '<%=basePath%>resource/script/plugins/uploadify/uploadify.swf',
		    uploader      : '<%=basePath%>upload',
		    fileSizeLimit   : 1000*1024,
		    fileTypeExts : '*.swf;*.gif;*.zip;*.jpg;*.jpeg;*.exe;*.bmp;*.apk;*.png;*.doc;*.docx;*.ppt;*.pptx;*.pdf;*.mp4;*.flv;*.rm;*.rmvb;*.3gp;*.mkv;*.avi;*.wmv;*.mp3;*.txt;*.epub;*.xls;*.xlsx',
		    fileTypeDesc : 'select',
		    multi : true,
		    uploadLimit : 0,
		    queueID  :  'queuelist',
		    onSelectError : function(file,errorCode,erorMsg){
		    	switch(errorCode) {
	             case -100:
	            	 this.queueData.errorMsg ="<s:text name='errorMsg1'/>";
	            	 break;
	             case -110:
	            	 this.queueData.errorMsg ="<s:text name='errorMsg2'/>";
	                 break;
	             case -120:
	            	 this.queueData.errorMsg ="<s:text name='errorMsg3'/>";
	                 break;
	         	}
	    	},
	    	onUploadStart : function(event){	            
           	},
           	onUploadProgress : function(event){
           	},
          	onQueueComplete : function(queueData){
		},
		onUploadSuccess : function (event, ID, fileObj, response, data) {
	     	},
	     	onCancel : function(){
	     	}
		});
	}


展开阅读全文
加载中
点击引领话题📣 发布并加入讨论🔥
打赏
0 评论
0 收藏
1
分享
返回顶部
顶部