The temporary upload location [/tmp/tomcat.XX/…] is not valid

Cause Analysis:
Procedures exist for MultipartFile type of operation (such as upload files), the server will temporarily save the file stream in the folder (specific folder by the spring boot at startup, the default is not / tmp folder).
/ tmp folder has an automatic cleanup mechanism, the files for the / tmp folder are not updated for 10 days, and the files for the / var / tmp folder are 30 days old.


1: specify the directory to prevent the folder is automatically deleted.

public class UploadFileConfigration {
 * Temporary file upload path
 MultipartConfigElement multipartConfigElement() {
 MultipartConfigFactory factory = new MultipartConfigFactory();
 return factory.createMultipartConfig();

Solution 2: Tomcat configuration file specified default log, dump and other file directory.


if you want to reproduce, please indicate the source: The temporary upload location [/tmp/tomcat.XX/…] is not valid - CodeDay