参考:
http://static.springsource.org/spring/docs/3.0.0.M3/spring-framework-reference/html/ch16s08.html
http://www.ioncannon.net/programming/975/spring-3-file-upload-example/
http://www.cnblogs.com/chenying99/archive/2012/03/13/2392695.html
记住在spring_servlet.xml里加上
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="500000"/>
</bean>
注意:在lib里必须要有commons-fileupload-xxx.jar and commons-io.jar file,如果你是用maven,那么用pom.xml里应该有下面的dependancy
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.1</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>