uploadifyプラグインの使用
2403 ワード
<%
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(){
}
});
}