gpt4 book ai didi

spring-boot - Windows 上的 Spring Boot,临时上传位置无效

转载 作者:行者123 更新时间:2023-12-02 02:52:36 24 4
gpt4 key购买 nike

我有一个在 Spring Boot 2.0.2 中构建的 Web 服务,并部署在基于 Windows 10 的机器上。

应用程序的任务之一是通过 POST 请求接受图像,然后将图像移动到系统上的特定位置,即 c:\ftp。最初应用程序工作正常,但是,在离开一段时间后,在收到新请求时,我看到以下错误;

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

我怀疑 Windows 正在删除旧的临时文件/文件夹,导致临时上传路径不再存在。

有没有人以前遇到过这个问题,有办法解决吗?

最佳答案

你好 SheppardDigital,

尝试添加属性

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

对于您的 application.properties 文件,此属性为 POST 请求使用的上传文件设置多部分临时位置。
请务必设置绝对 URL。

关于spring-boot - Windows 上的 Spring Boot,临时上传位置无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51403685/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com