0

I created an application that my user can upload, so far so good, but after a few days that my application is started his temporary directory disappears (I do not know if the OS goes out or something) and from then on the upload not It works more. I need to either restart my application or recreate the directory (an example directory "/tmp/tomcat.323231231312.8282/work/Tomcat/localhost/myapp"

[EDITED] I already saves all files in a separated file, but the springboot saves the files in a temp directory until upload finish, then I have access to that file

Fabio Ebner
  • 2,613
  • 16
  • 50
  • 77
  • Why are you using temp directories for an application that's expected to last a couple of days / requires persistence? – Alan Kavanagh Aug 12 '19 at 12:46
  • You should never use /tmp as it resets on server restart. Use something like /opt or /var – Amit Yadav Aug 12 '19 at 12:58
  • Possible duplicate of [How to create a directory on statup in spring boot project](https://stackoverflow.com/questions/56187233/how-to-create-a-directory-on-statup-in-spring-boot-project) – gmauch Aug 12 '19 at 13:31

2 Answers2

0

Why can`t you create sepearate directory for upload activities using spring boot and even log into seperate logger too? Any restriction from application side to go for temp?

Refer this if it replacates the same.

How to create a directory on statup in spring boot project

Try if this is useful How does one specify a temp directory for file uploads in Spring Boot?

RameshTech
  • 11
  • 2
0

Please provide below property :

spring.http.multipart.location: /data/upload_tmp

This will enable spring boot to create desired folder for hosting upload files.

The temporary upload location [/tmp/tomcat.4296537502689403143.5000/work/Tomcat/localhost/ROOT] is not valid

Techienik
  • 71
  • 3