Posting to Space (In Unity or Java)
Been fighting with this for a while and tempted to give up with spaces. I am trying to post a file into my space from either my Unity application (preferable) or from my server directly which is running on Java.
The AWS SDK is broken for Unity, which is why I turned to Digital Ocean in the first place, and now finding it pretty disheartening to see AWS SDK's being used as the answer for posting to spaces.
Anyway, I am seem to be closest in posting from the server, since I managed to post to S3 from it, but its just giving me horrible unhelpful errors of 'Invalid Argument'. Well that is great, which one is invalid :P
This is the code I am currently using:
awsS3credentials = new AWSStaticCredentialsProvider(new BasicAWSCredentials(Settings.S3AccessKey, Settings.S3SecretKey)); awsS3client = AmazonS3ClientBuilder.standard() .withCredentials(awsS3credentials) .withEndpointConfiguration(new EndpointConfiguration("nyc3.digitaloceanspaces.com", "nyc3")) .build(); PutObjectRequest put = new PutObjectRequest(Settings.BucketName, fileName, new ByteArrayInputStream(data), metadata); awsS3client.putObject(put);
I have ensured that my bucket name is my spaces name and that the keys are the correct ones from DO. Any ideas?
The code is basically taken from this thread: Link but my error is different.