这是一个使用腾讯云COS进行简单文件上传的方法,运行该方法抛出
Exception in thread "main" com.qcloud.cos.exception.CosClientException: Unable to calculate MD5 hash: 图片地址
+
Caused by: java.io.FileNotFoundException: 图片地址
的错误,请问该如何解决
public static String uploadFile2COS(String path){
COSClient cosClient= new TencentCloudServiceInit().txCOSInit();
String name="src/main/resources/static/defaultAvatar.jpg";
File localFile = new File(name);
PutObjectRequest putObjectRequest = new PutObjectRequest(__BUCKET_NAME, path, localFile);
PutObjectResult putObjectResult = cosClient.putObject(putObjectRequest);
cosClient.shutdown();
return putObjectResult.getETag();
}