Hi,
I’m trying to upload images, but I’m having problems.
When I upload it returns the error below:
com.amazonaws.services.s3.model.AmazonS3Exception: (Service: Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID: tx00000000000001bed1de2-005ebb0c82-1cff85-nyc3b), S3 Extended Request ID: null
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:730)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:405)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:212)
at com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:4912)
at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1960)
at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.uploadSinglePartAndWaitForCompletion(UploadTask.java:277)
at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:115)
at com.amazonaws.mobileconnectors.s3.transferutility.UploadTask.call(UploadTask.java:60)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:919)
Upload Code:
StaticCredentialsProvider credentials = new StaticCredentialsProvider(
new BasicAWSCredentials(context.getString(R.string.spaces_key),
context.getString(R.string.spaces_secret)));
AmazonS3Client s3 = new AmazonS3Client(credentials,Region.getRegion("us-east-1"));
s3.setEndpoint(context.getString(R.string.spaces_endPoint));
transferUtility = TransferUtility.builder().s3Client(s3).context(context).build();
TransferObserver observer = transferUtility.upload("",folder+"/"+nomeFoto,
file.getFileArquivo(),CannedAccessControlList.PublicReadWrite);
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello, @contato46fcfbc52233c726d3c
Have you tried to purge the cache if you have the CDN option enabled on your Space? Also in the CORS Configurations make sure you have the GET, PUT and POST methods allowed as well.
If this is not working I will recommend you to contact our support team and they will assist you with the issue.
https://www.digitalocean.com/support/
Hope that helps!
Regards, Alex
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.