|
@@ -17,9 +17,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class TencentCosUtils {
|
|
public class TencentCosUtils {
|
|
|
|
|
|
- public static void uploadFile(String secretId, String secretKey, String bucketName, String objectKey, MultipartFile file) {
|
|
|
|
|
|
+ public static void uploadFile(String secretId, String secretKey, String bucketName, String regionStr, String objectKey, MultipartFile file) {
|
|
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
|
|
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
|
|
- Region region = new Region("ap-shanghai");
|
|
|
|
|
|
+ Region region = new Region(regionStr);
|
|
ClientConfig clientConfig = new ClientConfig(region);
|
|
ClientConfig clientConfig = new ClientConfig(region);
|
|
clientConfig.setHttpProtocol(HttpProtocol.https);
|
|
clientConfig.setHttpProtocol(HttpProtocol.https);
|
|
COSClient cosClient = new COSClient(cred, clientConfig);
|
|
COSClient cosClient = new COSClient(cred, clientConfig);
|