SpringMVC上傳檔案的三種方法
直接上程式碼吧,大夥一看便知
這時:commonsmultipartresolver 的原始碼,可以研究一下 http://www.verysource.com/code/2337329_1/commonsmultipartresolver.java.html
前臺:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
<%@ page language=
"java"
contentType=
"text/html; charset=utf-8"
pageEncoding=
"utf-8"
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"
>
<html>
<head>
<meta http-equiv=
"Content-Type"
content= "text/html; charset=utf-8"
>
<title>Insert title here</title>
</head>
<body>
<form name=
"serForm"
action=
"/SpringMVC006/fileUpload"
method=
"post"
enctype=
"multipart/form-data"
>
<h1>採用流的方式上傳檔案</h1>
<input type=
"file"
name=
"file"
>
<input type=
"submit"
value=
"upload"
/>
</form>
<form name=
"Form2"
action=
|