| | |
| | | import java.util.Objects;
|
| | | import org.apache.commons.io.FilenameUtils;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import com.ruoyi.common.core.exception.file.FileException;
|
| | | import com.ruoyi.common.core.exception.file.FileNameLengthLimitExceededException;
|
| | | import com.ruoyi.common.core.exception.file.FileSizeLimitExceededException;
|
| | | import com.ruoyi.common.core.exception.file.InvalidExtensionException;
|
| | |
| | | /**
|
| | | * 默认大小 50M
|
| | | */
|
| | | public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
|
| | | public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L;
|
| | |
|
| | | /**
|
| | | * 默认的文件名最大长度 100
|
| | |
| | | {
|
| | | return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
|
| | | }
|
| | | catch (FileException fe)
|
| | | {
|
| | | throw new IOException(fe.getDefaultMessage(), fe);
|
| | | }
|
| | | catch (Exception e)
|
| | | {
|
| | | throw new IOException(e.getMessage(), e);
|