最近项目要开发一个多附件上传问题管理的需求,我们项目前端用的是miniui +jquery ,于是去miniui官网看有没有多附件上传相关的组件,发现一个MultiUpload Window的表单控件,看了下源代码基本上可以实现我想要的功能,下面贴一下我几天的研究成果。
MultiUpload 是基于swfupload封装好的一个多附件上传的控件
请求页面需要引入multiupload.css、swfupload.js、swfupload.swf、multiupload.js、cancel.gif,可以去官网下载源代码拷贝到自己的项目中来
“uploadurl”要最好使用绝对路径,相对路径“/**/”可能出现请求404的问题
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/resources/context/jspBase.jsp"%>
<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<title>Insert title here</title>
<%@ include file="/resources/context/headResource.jsp"%>
<link href="resources/plugins/multiUpload/multiupload.css" rel="stylesheet" type="text/css" />
<style>
html, body {
overflow: hidden; /* overflow|overflow-x|overflow-y : visible|hidden|scroll|auto */
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<script src="${basePath}resources/plugins/multiUpload/swfupload.js" type="text/javascript"></script>
<script src="${basePath}resources/plugins/multiUpload/multiupload.js" type="text/javascript"></script>
<!-- <script src="${basePath}/resources/plugins/multiUpload/boot.js" type="text/javascript"></script>--&