| | |
| | | ossClient.shutdown(); |
| | | // 把上传的文件路径返回 (手动拼接) |
| | | // 这里设置图片有效时间 我设置了30年 |
| | | Date expiration = new Date(System.currentTimeMillis() + 946080000 * 1000); |
| | | Date expiration = new Date(System.currentTimeMillis() + (long)(946080000 * 1000)); |
| | | String url = ossClient.generatePresignedUrl(bucketName, fileName, expiration).toString(); |
| | | |
| | | return url; |
| | |
| | | ossClient.shutdown(); |
| | | // 把上传的文件路径返回 (手动拼接) |
| | | // 这里设置图片有效时间 我设置了30年 |
| | | Date expiration = new Date(System.currentTimeMillis() + 946080000 * 1000); |
| | | Date expiration = new Date(System.currentTimeMillis() + (long)(946080000 * 1000)); |
| | | String url = ossClient.generatePresignedUrl(bucketName, fileName, expiration).toString(); |
| | | System.out.println("oss上传成功:" + url); |
| | | |