Browse Source

上传限制

master
zhouyl 12 months ago
parent
commit
82fbd5d47e
  1. 12
      tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java

12
tp-common/src/main/java/com/inscloudtech/common/utils/file/FileUploadUtils.java

@ -216,9 +216,9 @@ public class FileUploadUtils {
public static void assertAllowed(MultipartFile file, String[] allowedExtension)
throws FileSizeLimitExceededException, InvalidExtensionException {
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) {
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
// if (size > DEFAULT_MAX_SIZE) {
// throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
// }
String fileName = file.getOriginalFilename();
String extension = getExtension(file);
@ -250,9 +250,9 @@ public class FileUploadUtils {
public static boolean checkFileValid(MultipartFile file)
throws FileSizeLimitExceededException, InvalidExtensionException {
long size = file.getSize();
if (size > DEFAULT_MAX_SIZE) {
throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
}
// if (size > DEFAULT_MAX_SIZE) {
// throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
// }
String[] allowedExtension = MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION;
String fileName = file.getOriginalFilename();
String extension = getExtension(file);

Loading…
Cancel
Save