![在这里插入图片描述](https://img-blog.csdnimg.cn/20190313154732374.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMzg2NzU0,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190313154806509.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMzg2NzU0,size_16,color_FFFFFF,t_70)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190313155159870.png)
<!--配置文件上传转换器-->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!--定义默认编码-->
<property name="defaultEncoding" value="UTF-8"/>
<!--设置最大上传大小-->
<property name="maxUploadSize" value="1024000"/>
</bean>
<form method="post" action="testFileUpload" enctype="multipart/form-data">
请选择文件:<input type="file" placeholder="请选择文件" name="file"/><br/>
文件的说明:<input type="text" name="info" />
<input type="submit" value="提交"/>
</form>
@RequestMapping("/testUploadFile")
public String testUploadFile(@RequestParam("file")MultipartFile file,@RequestParam("info")String info) throws IOException {
System.out.println("文件信息:"+info);
System.out.println("文件名称:"+file.getOriginalFilename());
System.out.println("文件大小为:"+file.getSize());
System.out.println(file.getInputStream());
return "success";
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190313160958849.png)
![在这里插入图片描述](https://img-blog.csdnimg.cn/20190313161027195.png)