Help Center> Object Storage Service> SDK Reference> Java> Object Upload> Performing a File-Based Upload

Performing a File-Based Upload

If you have any questions during development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference

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

String endPoint = "https://your-endpoint";
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", "objectname", new File("localfile")); // localfile indicates the path of the local file to be uploaded. You need to specify the file name.

The content to be uploaded cannot exceed 5 GB.