Simple Upload
Last Updated:2020-11-11
Basic Introduction
After creating the bucket, the user can upload the file and save it in the bucket. Users can upload a single file smaller than 5GB through the PutObject interface.
Operation Method
Users can use the console to upload a single file. BOS also supports the use of API and SDK to upload a single object, as follows:
-
Use console to upload a single file
- Log in to the MMC and enter "Storage and CDN > Baidu Object Storage".
- Click the bucket you want to upload the file to in the "File list" area. On the file list page on the right, click the "Upload a file" button. The upload file window is as follows.
- You can upload files by dragging or directly selecting files. At the same time, you can choose to verify MD5 and modify the file storage type when uploading.
- Use Putobject API Interface to Upload Object
-
Use SDK to upload object:
Example
Below are the example codes for Java SDK:
public void PutObject(BosClient client, String bucketName, String objectKey){
// Access specified files
File file = new File("/path/to/file.zip");
// Upload object as file
PutObjectResponse putObjectFromFileResponse = client.putObject(bucketName, objectKey, file);