| | |
| | | OSS ossClient = createOss(); |
| | | PutObjectResult result = null; |
| | | try { |
| | | |
| | | String fileName = FileUploadUtils.extractFilename(file); |
| | | String objectName = filePath + uuid; |
| | | String prefix = fileName.substring(fileName.lastIndexOf(".")); |
| | | String objectName = filePath + uuid + prefix; |
| | | InputStream inputStream = file.getInputStream(); |
| | | // 创建PutObjectRequest对象。 |
| | | PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectName, inputStream); |
| | |
| | | if (ossClient != null) { |
| | | ossClient.shutdown(); |
| | | } |
| | | return result.getResponse().getErrorResponseAsString(); |
| | | } |
| | | return result.getResponse().getErrorResponseAsString(); |
| | | } |
| | | |
| | | } |