I am using following code to upload a file into the S3 bucket:
//upload code start
AWSCredentials credential = new BasicAWSCredentials(AppConstants.AWS_ACCESS_KEY_ID, AppConstants.AWS_SECRET_ACCESS_ID);
TransferManager manager = new TransferManager(credential);
// Transfer a file to an S3 bucket.
Upload upload = manager.upload("bucket_name", AppConstants.AWS_ACCESS_KEY_ID, file);
while (!upload.isDone()) {
Thread.sleep(200);
}
//upload code end
I want to put this into a directory named "android_uploads" inside my bucket but Transfer Manager is uploading all the files into root of the bucket.
Any idea how i can achieve this?
Your call to upload() is incorrect. It should be like: