• Object Storage Service

  1. Help Center
  2. Object Storage Service
  3. Developer Guide (Java SDK)
  4. Object Upload
  5. Performing a File-Based Upload

Performing a File-Based Upload

File-based upload uses local files as the data source of objects. Sample code is as follows:

String endPoint = "yourdomainname";
String ak = "*** Provide your Access Key ***";
String sk = "*** Provide your Secret Key ***";
// Create an instance of ObsClient.
ObsClient obsClient = new ObsClient(ak, sk, endPoint);

obsClient.putObject("bucketname", "objectkey", new File("localfile"));

// Close obsClient.