标签:
1.jsp代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <link rel="stylesheet" href="${ctx}/static/js/plupload/queue/css/jquery.plupload.queue.css" type="text/css"></link> <script type="text/javascript" src="${ctx}/static/js/plupload/plupload.js"></script> <script type="text/javascript" src="${ctx}/static/js/plupload/plupload.html4.js"></script> <script type="text/javascript" src="${ctx}/static/js/plupload/plupload.html5.js"></script> <script type="text/javascript" src="${ctx}/static/js/plupload/plupload.flash.js"></script> <script type="text/javascript" src="${ctx}/static/js/plupload/zh_CN.js"></script> <script type="text/javascript" src="${ctx}/static/js/plupload/queue/jquery.plupload.queue.js"></script> <script type="text/javascript"> var ctx=‘${ctx}‘+‘static/js/‘; var files = []; var errors = []; var type = ‘file‘; var max_file_size = ‘10mb‘; $(document).ready(function(){ var filters = {title : "文档", extensions : "xml"}; $("#uploader").pluploadQueue($.extend({ runtimes : ‘html5,html4,flash‘, url : ‘localUpLoadProgram‘, max_file_size : max_file_size, file_data_name:‘file‘, unique_names:true, filters : [filters], flash_swf_url : ctx+‘plupload/plupload.flash.swf‘, init:{ FileUploaded:function(uploader,file,response){ if(response.response){ var rs = $.parseJSON(response.response); if(rs.status){ files.push(file.name); }else{ errors.push(file.name); } } }, UploadComplete:function(uploader,fs){ //var e= errors.length ? ",失败"+errors.length+"个("+errors.join("、")+")。" : "。"; // alert("上传完成!共"+fs.length+"个。成功"+files.length+e); //target.window("close"); } } },(true ? {chunk_size:‘1mb‘} : {}))); }); </script> <div id="uploader"> </div>
@RequestMapping("/standsUpLoadProgram") @ResponseBody public void standsUpLoadProgram( @RequestParam("file") CommonsMultipartFile[] file, HttpServletResponse response) throws Exception { if (file.length <= 0) { return; } for (int i = 0; i < file.length; i++) { InputStream inputFile = file[i].getInputStream(); saveStandsDate(inputFile); } }
Plupload+easyui+springmvc实现批量上传
标签:
原文地址:http://www.cnblogs.com/holdon521/p/4570004.html