| | |
| | | return fileName;
|
| | | }
|
| | |
|
| | | private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
| | | public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
|
| | | {
|
| | | File desc = new File(uploadDir + File.separator + fileName);
|
| | |
|
| | | if (!desc.getParentFile().exists())
|
| | | {
|
| | | desc.getParentFile().mkdirs();
|
| | | }
|
| | | if (!desc.exists())
|
| | | {
|
| | | desc.createNewFile();
|
| | | if (!desc.getParentFile().exists())
|
| | | {
|
| | | desc.getParentFile().mkdirs();
|
| | | }
|
| | | }
|
| | | return desc;
|
| | | }
|
| | |
|
| | | private static final String getPathFileName(String uploadDir, String fileName) throws IOException
|
| | | public static final String getPathFileName(String uploadDir, String fileName) throws IOException
|
| | | {
|
| | | int dirLastIndex = RuoYiConfig.getProfile().length() + 1;
|
| | | String currentDir = StringUtils.substring(uploadDir, dirLastIndex);
|
| | |
| | | throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
|
| | | fileName);
|
| | | }
|
| | | else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
|
| | | {
|
| | | throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
|
| | | fileName);
|
| | | }
|
| | | else
|
| | | {
|
| | | throw new InvalidExtensionException(allowedExtension, extension, fileName);
|