ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/FastDfsSysFileServiceImpl.java
@@ -37,10 +37,20 @@ @Override public String uploadFile(MultipartFile file) throws Exception { InputStream inputStream = file.getInputStream(); StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), FileTypeUtils.getExtension(file), null); IoUtils.closeQuietly(inputStream); InputStream inputStream = null; try { inputStream = file.getInputStream(); StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(), FileTypeUtils.getExtension(file), null); return domain + "/" + storePath.getFullPath(); } catch (Exception e) { throw new RuntimeException("FastDfs Failed to upload file", e); } finally { IoUtils.closeQuietly(inputStream); } } } ruoyi-modules/ruoyi-file/src/main/java/com/ruoyi/file/service/MinioSysFileServiceImpl.java
@@ -34,8 +34,11 @@ @Override public String uploadFile(MultipartFile file) throws Exception { InputStream inputStream = null; try { String fileName = FileUploadUtils.extractFilename(file); InputStream inputStream = file.getInputStream(); inputStream = file.getInputStream(); PutObjectArgs args = PutObjectArgs.builder() .bucket(minioConfig.getBucketName()) .object(fileName) @@ -43,7 +46,15 @@ .contentType(file.getContentType()) .build(); client.putObject(args); IoUtils.closeQuietly(inputStream); return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName; } catch (Exception e) { throw new RuntimeException("Minio Failed to upload file", e); } finally { IoUtils.closeQuietly(inputStream); } } }