【发布时间】:2018-04-16 04:16:00
【问题描述】:
最近我正在开发一个提供上传图片功能的 REST API。一切正常,但是我的后端服务器位置被图像副本填满。看起来 spring 保留了它上传的每张图像的本地副本。是否有任何选项可以禁用本地副本的保存。我快速浏览了文档,我可以在下面找到多部分文件的属性。
# MULTIPART (MultipartProperties)
spring.servlet.multipart.enabled=true # Whether to enable support of
multipart uploads.
spring.servlet.multipart.file-size-threshold=0 # Threshold after which files
are written to disk. Values can use the suffixes "MB" or "KB" to indicate
megabytes or kilobytes, respectively.
spring.servlet.multipart.location= # Intermediate location of uploaded
files.
spring.servlet.multipart.max-file-size=1MB # Max file size. Values can use
the suffixes "MB" or "KB" to indicate megabytes or kilobytes, respectively.
spring.servlet.multipart.max-request-size=10MB # Max request size. Values
can use the suffixes "MB" or "KB" to indicate megabytes or kilobytes,
respectively.
spring.servlet.multipart.resolve-lazily=false # Whether to resolve the
multipart request lazily at the time of file or parameter access.
我们可以告诉系统复制本地副本的位置,但没有禁用它的选项。各位对此有什么建议吗?我们是否需要一个单独的程序来清除这些本地图像副本并节省空间?
谢谢, 凯斯
【问题讨论】:
标签: spring-boot multipart