SpringMVC文件上传和下载

设置下载(会自动调用浏览器的下载器,固定格式)

response.setHeader("Content-Disposition","attachment;filename="+System.currentTimeMiles+".txt");
response.getWriter().write();
response.getWriter().flush();

上传:

<dependency>
	<groupId>commons-fileuploadgroupId>
	<artifactId>commons-fileuploadartifactId>
	<version>1.4verion>
dependency>

让文件上传配置生效

你可能感兴趣的:(SpringMVC,SpringMVC)