Uploading an Object
Application Scenario
You can upload files or folders to an existing OBS bucket. If you want to classify files to be uploaded, create a folder and upload related files to the folder.
For details about how to create a folder, see Creating a Folder.
These files can be texts, images, videos, or any other type of files.
Constraints
- OBS Console allows you to upload files in batches. A maximum of 100 files can be uploaded at a time, with a total size of no more than 5 GB. If you upload only one file in batch upload mode, this file cannot exceed 5 GB in size.
- You can use OBS Browser+ and obsutil to upload files with a total size smaller than 48.8 TB. OBS Browser+ allows you to upload a maximum of 500 files at a time. There is no limit on the number of files you can upload using obsutil at a time.
- Using SDK/API PUT, POST, or appendable operations, you can upload files with a total size smaller than 5 GB.
- Using SDK/API multipart upload or SDK resumable upload, you can upload files with a total size smaller than 48.8 TB.
- The batch upload function is available only when the following conditions are met:
The bucket version must be 3.0. For details about how to view the bucket version, see Checking OBS Version (OBS 2.0 or OBS 3.0).
- You can directly upload folders through OBS Console, OBS Browser+, or obsutil.
- You can set a bucket quota to limit the capacity of objects to be uploaded to a bucket. For details, see Managing Bucket Quotas.
- If versioning is disabled and the name of a newly uploaded file is the same as that of a file in the bucket, the newly uploaded file automatically overwrites the existing file and does not retain the ACL information of the existing file. If the name of the newly uploaded folder is the same as that of a folder in the bucket, the two folders will be merged, and files in the new folder will overwrite namesake files in the old folder.
- If versioning is enabled and the name of a newly uploaded file is the same as that of a file in the bucket, a new version is added to the existing file. For details about versioning, see Versioning.
Upload Methods
| Upload Method | Description |
|---|---|
| PUT (Streaming upload) | Use the PUT or POST method when the size of the file to be uploaded is less than 5 GB. For details about the differences between the two upload methods, see What Are the Differences Between PUT and POST Upload Methods? |
| POST (browser-based upload) | |
| Multipart upload | Use this method when the size of the file to be uploaded is greater than 5 GB and less than 48.8 TB. For details, see Multipart Upload. NOTE: If you have a large amount of data (greater than 48.8 TB) to be uploaded, refer to Migrating Local Data to OBS and Migrating Data from Third-Party Cloud Service Vendors to OBS. |
| Resumable transfer | Uploading large files often fails due to poor network conditions or program breakdowns. It is a waste of resources to restart the upload process upon an upload failure, and the restarted upload process may still suffer from the unstable network. To resolve such issues, you can use the API for resumable upload, whose working principle is to divide the to-be-uploaded file into multiple parts and upload them separately. This method saves resources and improves efficiency upon the re-upload, and speeds up the upload process by concurrently uploading parts. For details, see Does OBS Support Resumable Data Transfer? |
| Synchronous upload of incremental objects | This method synchronizes all content in the local source path to the specified target bucket in OBS, ensuring that the content is consistent between the local path and the target bucket. Incremental synchronization has the following meanings: 1) Increment: Compare the source file with the target object and upload only the source file that has changes. 2) Synchronization: After the command is executed, ensure that the local source path is a subset of the target bucket specified by OBS. That is, any file in the local source path has its corresponding object in the target bucket on OBS. For details, see Synchronously Uploading Incremental Objects. |
| Appendable upload | The AppendObject operation adds data to the end of an object in a specified bucket. If there is no namesake object in the bucket, a new object is created. For details, see Appending an Object. |
Methods of Using This Function
You can use OBS Console, APIs, SDKs, OBS Browser+, or obsutil to upload an object.
| Tool | Reference |
|---|---|
| OBS Console | |
| SDKs | OBS supports software development kits (SDKs) in multiple languages. For details, see the corresponding developer guide on the SDK Overview page. |
| APIs | |
| OBS Browser+ | |
| obsutil |
Related Operations
You can specify its storage class when uploading an object or change its storage class after the upload.
- Objects can be changed from Standard to Infrequent Access or Archive storage class, or from Infrequent Access to Standard or Archive storage class, but objects in Archive storage class must be restored before being changed to Standard or Infrequent Access storage class. Changing from Infrequent Access or Archive to other storage classes incurs restoration fees. Select an appropriate change option based on your needs.
- You can also configure a lifecycle rule to change the storage class of an object. For details, see Lifecycle Management.
Causes of Object Upload Failures and Solutions
For details, see Failed to Upload an Object.
Last Article: Creating a Folder
Next Article: Downloading an Object
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.