Springmvc + ajaxfileupload +jquery
Jquery 文件上传,这个搞了一天才搞好,网上例子虽然多,可是没怎么看懂
下载 ajaxfileupload.js
Jsp 示例代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'main2.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<!-- 导入对应的样式和js -->
<script src="<%=basePath%>css/theme/scripts/jquery-
1.8.2.min.js"></script>
<script src="<%=basePath
%>css/theme/scripts/ajaxfileupload.js"></script>
<!-- 执行上传文件操作的函数 -->
评论15