您的位置:首页 > 产品设计 > UI/UE

Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location

2017-11-13 17:44 1106 查看
spring-boot项目,生产环境运行一段时间后,上传图片报错,如下:

threw exception [Request processing failed; nested exception is org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.2982178524163133296.8080/work/Tomcat/localhost/ssc] is not valid] with root cause] |
java.io.IOException: The temporary upload location [/tmp/tomcat.2982178524163133296.8080/work/Tomcat/localhost/ssc] is not valid

解决方案:添加指定目录

@Configuration
public class MultipartConfig {
/**
* 文件上传临时路径
*/
@Bean
MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
factory.setLocation("/data/dubbo/cache");
return factory.createMultipartConfig();
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐