SheppardDigital
SheppardDigital

Reputation: 3255

Spring Boot on Windows, invalid temporary upload location

I have a web service built in Spring Boot 2.0.2 and deployed on a Windows 10 based machine.

One of the tasks of the application is to accept an image via a POST request and then move the image to a specific location on the system, i.e. c:\ftp. Initially the application works fine, however, after a period of being left, upon a new request I'm seeing the error below;

Failed to parse multipart servlet request; nested exception is java.io.IOException: The temporary upload location [C:\\Users\\FRONTIER\\AppData\\Local\\Temp\\tomcat.10182171515108748004.8080\\work\\Tomcat\\localhost\\ROOT] is not valid

I suspect that Windows is deleting old temporary files/folders, resulting in the temporary upload path no longer being present.

Has anyone come across this issue before, and is there a way to fix it?

Upvotes: 4

Views: 5088

Answers (1)

Ice Carev
Ice Carev

Reputation: 38

Hello SheppardDigital,

try adding the property

spring.servlet.multipart.location=C:\\Users\\admin\\Desktop\\Perfect_APP\\

to your application.properties file, this property sets the multipart temp location for uploaded files which the POST requests use. Be sure to set an absolute URL.

Upvotes: 1

Related Questions