springboot项目报错:Failed to parse multipart servlet request; nested exception is java.io.IOException:

报错:Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [/tmp/tomcat.6348303759597414822.8085/work/Tomcat/localhost/ROOT] is not valid

 

 

增加配置

server:
  tomcat:
    basedir: /home/temp

 

或者

/**
 * 文件上传临时路径
 */
 @Bean
 MultipartConfigElement multipartConfigElement() {
    MultipartConfigFactory factory = new MultipartConfigFactory();
    factory.setLocation("/home/temp");
    return factory.createMultipartConfig();
}

 

posted @ 2022-04-29 15:02  yvioo  阅读(670)  评论(0编辑  收藏  举报