mvc.xml中加入(id不能修改):
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="10485760"/>
<property name="maxInMemorySize" value="40960" />
</bean>
jsp中必须加入method="post" enctype="multipart/form-data"
<form action="/file/upload" method="post" enctype="multipart/form-data" >
</form>