Upload an object from a file
Note: This example assumes that the Bucket sample exists.
Example: Upload an Object from a File to a Bucket in a system using the s3Client.putObject() method
AmazonS3 s3Client = new AmazonS3Client();
s3Client.setEndpoint("https://systemname.example.com");
s3Client.putObject(
"sample", 1
"myfile", 2
new File("/home/user/test.txt") 3
);
1 The name of the Bucket into which the Object will be placed.
2 The name of the Object once it has been uploaded.
3 The file name and path of the file to be uploaded.