| | |
| | | /** |
| | | * 文件上传 |
| | | * |
| | | * @param file |
| | | * 要上传的文件 |
| | | * @param file 要上传的文件 |
| | | * @return |
| | | */ |
| | | public String upload(MultipartFile file, String name) { |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 文件上传 |
| | | * |
| | | * @param file |
| | | * 要上传的文件 |
| | | * @param file 要上传的文件 |
| | | * @return |
| | | */ |
| | | public String uploadFile(File file, String name) { |
| | |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 删除 |
| | | * |
| | | * @param fileName |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public String removeMinio(String fileName) { |
| | | try { |
| | | //创建MinioClient对象 |
| | | //fileName = "6edbdf8c2a1146ddaf4fbfcb30f804ad/72b2a44c18a54802854931a65b604576.jpg" |
| | | MinioClient minioClient = new MinioClient(minioProperties.getHost(), minioProperties.getAccessKey(), |
| | | minioProperties.getSecretKey()); |
| | | minioClient.removeObject(minioProperties.getBucket(), fileName); |
| | | return "success"; |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return e.getMessage(); |
| | | } |
| | | |
| | | } |
| | | } |