Here is my code to upload image to digital ocean from spring boot using aws s3 sdk
AWSCredentialsProvider awscp = new AWSStaticCredentialsProvider(
new BasicAWSCredentials("clientId", "client_secret")
);
AmazonS3 space = AmazonS3ClientBuilder
.standard()
.withCredentials(awscp)
.withEndpointConfiguration(
new AwsClientBuilder.EndpointConfiguration("https://myproject.fra1.digitaloceanspaces.com", "fra1")
)
.build();
byte[] byteImage = Base64.getMimeDecoder().decode(data.filePath.split(",")[1]);
InputStream is = new ByteArrayInputStream(byteImage);
ObjectMetadata om = new ObjectMetadata();
om.setContentLength(byteImage.length);
om.setContentType("image/jpg");
String filepath = "/images/"+ System.currentTimeMillis()+".jpg";
space.putObject("myproject", filepath, is, om);
but this is giving InvocationTargetException: 400 bad request
I am uploading from my local machine and i have set cors for *
what is wrong in this code