fix: 设置上传文件最大大小

This commit is contained in:
xiongxiaoyang 2022-05-22 10:02:59 +08:00
parent 61cc3b5f07
commit 5e01c1c5a1
2 changed files with 7 additions and 1 deletions
src/main
java/io/github/xxyopen/novel/core/interceptor
resources

@ -31,7 +31,7 @@ public class FileInterceptor implements HandlerInterceptor {
String requestUri = request.getRequestURI();
// 缓存10天
response.setDateHeader("expires", System.currentTimeMillis() + 60 * 60 * 24 * 10 * 1000);
try (OutputStream out = response.getOutputStream();InputStream input = new FileInputStream(fileUploadPath + requestUri)) {
try (OutputStream out = response.getOutputStream(); InputStream input = new FileInputStream(fileUploadPath + requestUri)) {
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1; ) {
out.write(b, 0, n);

@ -6,6 +6,12 @@ spring:
jackson:
generator:
write-numbers-as-strings: true
servlet:
# 上传文件最大大小
multipart:
max-file-size: 5MB
server:
port: 8888