หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Initiating a Multipart Upload

Updated on 2024-09-29 GMT+08:00

Functions

Before using this operation, make an API operation call to create a multipart upload task. The system will return a globally unique upload ID as the multipart upload identifier. You can use this ID to upload, assemble, and list parts. Create a multipart upload task does not affect the object that has the same name as object to be uploaded in multiple parts. You can create more than one multipart upload tasks for an object. This operation request can contain headers x-obs-acl, x-obs-meta-*, Content-Type, and Content-Encoding. The headers are recorded in the multipart upload metadata.

This operation supports server-side encryption.

WORM

If a bucket has WORM enabled, you can configure object-level retention policies when initiating multipart uploads. You can specify the x-obs-object-lock-mode and x-obs-object-lock-retain-until-date headers when you initiate a multipart upload to protect the object assembled. If you do not specify these two headers but have configured a default bucket-level WORM policy, this default policy automatically applies to the object newly assembled. You can also configure or update a WORM retention policy after the object is assembled.

Different from uploads with PUT and POST, a multipart upload only requires that the date specified in the x-obs-object-lock-retain-until-date header be no later than the initiation time, but does not have to be later than the completion time of the multipart upload. When the default bucket-level WORM policy is applied, the protection starts when the object parts are assembled and ends once the default bucket-level protection period expires. Before assembling the object parts uploaded, the multipart upload can be canceled and will not be affected by the WORM configuration.

Request Syntax

1
2
3
4
POST /ObjectName?uploads  HTTP/1.1  
Host: bucketname.obs.region.myhuaweicloud.com 
Date: date
Authorization: authorization

Request Parameters

This request uses parameters to specify a multipart upload. Table 1 describes the parameters.

Table 1 Request parameters

Parameter

Type

Mandatory (Yes/No)

Description

uploads

String

Yes

Explanation:

Indicates a multipart upload.

Restrictions:

  • This parameter is an empty string.
  • If this parameter is not included, the request is treated as an ordinary POST upload.

Value range:

An empty string.

Default value:

None

encoding-type

String

No

Explanation:

Encoding type for Key in the response. If Key in the response contains control characters that are not supported by the XML 1.0 standard, you can specify this parameter to encode Key.

Restrictions:

None

Value range:

URL

Default value:

None. If you do not specify this parameter, encoding is not applied.

Request Headers

The request can use additional headers shown in Table 2.

Table 2 Request headers

Header

Type

Mandatory (Yes/No)

Description

x-obs-acl

String

No

Explanation:

When initiating a multipart upload, you can add this header to set an object ACL.

Example: x-obs-acl: public-read-write

Restrictions:

Use character strings.

Value range:

  • private
  • public-read
  • public-read-write

For details about each policy, see the "Configuring an ACL Using Header Fields" section in ACLs.

Default value:

private

x-obs-grant-read

String

No

Explanation:

When initiating a multipart upload, you can use this header to grant all users in a domain the permissions to read the object and obtain the object metadata.

Example: x-obs-grant-read: ID=domainID.

Restrictions:

If multiple accounts are authorized, separate them with commas (,).

Value range:

None

Default value:

None

x-obs-grant-read-acp

String

No

Explanation:

When initiating a multipart upload, you can use this header to grant all users in a domain the permissions to obtain the object ACL.

Example: x-obs-grant-read-acp: ID=domainID.

Restrictions:

If multiple accounts are authorized, separate them with commas (,).

Value range:

None

Default value:

None

x-obs-grant-write-acp

String

No

Explanation:

When initiating a multipart upload, you can use this header to grant all users in a domain the permissions to write the object ACL.

Example: x-obs-grant-write-acp: ID=domainID

Restrictions:

If multiple accounts are authorized, separate them with commas (,).

Value range:

None

Default value:

None

x-obs-grant-full-control

String

No

Explanation:

When initiating a multipart upload, you can use this header to grant all users in a domain the following permissions:

Permissions to read objects, obtain object metadata, obtain object ACLs, and write object ACLs.

Example: x-obs-grant-full-control: ID=domainID.

Restrictions:

If multiple accounts are authorized, separate them with commas (,).

Value range:

None

Default value:

None

x-obs-storage-class

String

No

Explanation:

When initiating a multipart upload, you can add this header to specify the storage class for the object.

Example: x-obs-storage-class: STANDARD

Restrictions:

  • If you do not use this header, the object storage class is the default storage class of the bucket.
  • The value is case-sensitive.

Value range:

  • STANDARD
  • WARM
  • COLD
  • DEEP_ARCHIVE

Default value:

By default, the storage class of the bucket is inherited.

x-obs-persistent-headers

String

No

Explanation:

When initiating a multipart upload, you can add the x-obs-persistent-headers header in an HTTP request to specify one or more user-defined response headers. After all parts in the multipart upload are merged, user-defined response headers will be returned in the response header when you retrieve the object or query the object metadata.

Restrictions:

  • Response headers customized in this way cannot be prefixed with x-obs-. For example, you should use key1 instead of x-obs-key1.
  • Standard HTTP headers, such as host, content-md5, origin, range, and Content-Disposition, cannot be specified as user-defined headers.
  • The total length of this header and the custom metadata cannot exceed 8 KB.
  • If multiple values are passed for the same key, they are separated by commas (,) and returned all at once for that key.
  • If the decoded value contains non-US-ASCII or unrecognizable characters, the server processes the value as a string and encapsulates it using ?UTF-8?B?<(str)>?=, but does not decode the value. For instance, value key1:abbc will be returned as key1:=?UTF-8?B?abbc?= in the response.
  • The values cannot contain spaces, equal signs (=), commas (,), semicolons (;), colons (:), or periods (.). If such characters are required, use URL or Base64 encoding.
  • Format: x-obs-persistent-headers: key1:base64_encode(value1),key2:base64_encode(value2)...

    Note: Items, such as key1 and key2, are user-defined headers. If they contain non-ASCII or unrecognizable characters, they can be encoded using URL or Base64. The server processes these headers as character strings, but does not decode them. Items, such as value1 and value2 are the values of the corresponding headers. base64_encode indicates that the value is encoded using Base64. A user-defined header and its Base64-encoded value are connected using a colon (:) to form a key-value pair. All key-value pairs are separated with a comma (,) and are placed in the x-obs-persistent-headers header. The server then decodes the uploaded value.

    Example: x-obs-persistent-headers: key1:dmFsdWUx,key2:dmFsdWU

    After all parts in the multipart upload are assembled, headers key1:value1 and key2:value2 will be returned, respectively, when you download the object and obtain the object metadata.

Value range:

None

Default value:

None

x-obs-website-redirect-location

String

No

Explanation:

If the bucket is configured with website hosting, the request for obtaining the object can be redirected to another object in the bucket or an external URL.

To another object in the same bucket:

WebsiteRedirectLocation:/anotherPage.html

To an external URL:

WebsiteRedirectLocation:http://www.example.com/

OBS obtains the specified value from the header and stores it in the object metadata WebsiteRedirectLocation.

Restrictions:

  • The value must start with a slash (/), http://, or https:// and cannot exceed 2 KB.
  • OBS supports redirection for objects in the root directory of a bucket, not for those in folders.

Default value:

None

x-obs-server-side-encryption

String

No. This header is required when SSE-KMS is used.

Explanation:

Indicates that SSE-KMS is used.

Example: x-obs-server-side-encryption: kms

Restrictions:

None

Value range:

  • kms
  • AES256

Default value:

None

x-obs-server-side-encryption-kms-key-id

String

No

Explanation:

ID of a specified key used for SSE-KMS encryption. For details about how to obtain a key ID, see Viewing a Key.

Restrictions:

This header can only be used when you specify kms for the x-obs-server-side-encryption header.

Default value:

If you specify kms for encryption but do not specify a key ID, the default master key will be used. If there is not a default master key, OBS will create one and use it.

x-obs-server-side-encryption-customer-algorithm

String

No. This header is required when SSE-C is used.

Explanation:

The algorithm used for encryption.

Example: x-obs-server-side-encryption-customer-algorithm: AES256

Restrictions:

  • This header is used only when SSE-C is used.
  • This header must be used together with x-obs-server-side-encryption-customer-key and x-obs-server-side-encryption-customer-key-MD5.

Value range:

AES256

Default value:

None

x-obs-server-side-encryption-customer-key

String

No. This header is required when SSE-C is used.

Explanation:

The key used for encrypting an object.

Example: x-obs-server-side-encryption-customer-key:K7QkYpBkM5+hca27fsNkUnNVaobncnLht/rCB2o/9Cw=

Restrictions:

  • This header is used only when SSE-C is used.
  • This header is a Base64-encoded 256-bit key and must be used together with x-obs-server-side-encryption-customer-algorithm and x-obs-server-side-encryption-customer-key-MD5.

Value range:

None

Default value:

None

x-obs-server-side-encryption-customer-key-MD5

String

No. This header is required when SSE-C is used.

Explanation:

The MD5 value of the encryption key. The MD5 value is used to check whether any error occurs during the transmission of the key.

Example: x-obs-server-side-encryption-customer-key-MD5:4XvB3tbNTN+tIEVa0/fGaQ==

Restrictions:

  • This header is used only when SSE-C is used.
  • This header is a Base64-encoded 128-bit MD5 value and must be used together with x-obs-server-side-encryption-customer-algorithm and x-obs-server-side-encryption-customer-key.

Value range:

Base64-encoded MD5 value of the key ID.

Default value:

None

x-obs-expires

Integer

No

Explanation:

Specifies when an object expires. It is measured in days. Once the object expires, it is automatically deleted. (The calculation starts from when the object was last modified).

Example: x-obs-expires:3

Restrictions:

This parameter can be configured only when uploading the object. It cannot be modified by calling a metadata modification API.

Value range:

An integer greater than or equal to 0, in days

Default value:

None

x-obs-object-lock-mode

String

No, but required when x-obs-object-lock-retain-until-date is present.

Explanation:

WORM mode to be applied to an object.

Example: x-obs-object-lock-mode:COMPLIANCE

Restrictions:

This parameter must be used together with x-obs-object-lock-retain-until-date.

Value range:

Only COMPLIANCE (compliance mode) is supported.

Default value:

None

x-obs-object-lock-retain-until-date

String

No, but required when x-obs-object-lock-mode is present.

Explanation:

When the WORM policy of the object expires.

Example: x-obs-object-lock-retain-until-date:2015-07-01T04:11:15Z

Restrictions:

  • The value must be a UTC time that complies with the ISO 8601 standard. Example: 2015-07-01T04:11:15Z
  • This parameter must be used together with x-obs-object-lock-mode.

Value range:

The time must be later than the current time.

Default value:

None

x-obs-meta-*

String

No

Explanation:

When initiating a multipart upload, you can use a header starting with x-obs-meta- in the HTTP request to define object metadata for easy management. The custom metadata will be returned in the response when you retrieve the object or query the object metadata. For details, see User-Defined Object Metadata.

Example: x-obs-meta-test: test metadata

Restrictions:

This parameter can only be passed in HTTP request headers and cannot exceed 8 KB.

Value range:

None

Default value:

None

For details about other common message headers, see Table 3.

Request Elements

This request involves no elements.

Response Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
HTTP/1.1 status_code
Date: date
Content-Length: length
Connection: status

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<InitiateMultipartUploadResult xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/">
    <Bucket>BucketName</Bucket>  
    <Key>ObjectName</Key>  
    <UploadId>uploadID</UploadId> 
</InitiateMultipartUploadResult> 

Response Headers

The response to the request uses common headers. For details, see Table 1.

Table 3 Additional response headers

Header

Type

Description

x-obs-server-side-encryption

String

Explanation:

The encryption method used by the server.

Example: x-obs-server-side-encryption: kms

Restrictions:

This header is included in a response if SSE-KMS is used.

Value range:

  • kms
  • AES256

Default value:

None

x-obs-server-side-encryption-kms-key-id

String

Explanation:

ID of a specified key used for SSE-KMS encryption. For details about how to obtain a key ID, see Viewing a Key.

Restrictions:

This header can only be used when you specify kms for the x-obs-server-side-encryption header.

Default value:

If you specify kms for encryption but do not specify a key ID, the default master key will be used. If there is not a default master key, OBS will create one and use it.

x-obs-server-side-encryption-customer-algorithm

String

Explanation:

The algorithm used for encryption.

Example: x-obs-server-side-encryption-customer-algorithm: AES256

Restrictions:

This header is included in a response if SSE-C is used for server-side encryption.

Value range:

AES256

Default value:

None

x-obs-server-side-encryption-customer-key-MD5

String

Explanation:

The MD5 value of the encryption key.

Example: x-obs-server-side-encryption-customer-key-MD5:4XvB3tbNTN+tIEVa0/fGaQ==

Restrictions:

This header is included in a response if SSE-C is used for server-side encryption.

Value range:

Base64-encoded MD5 value of the key ID.

Default value:

None

Response Elements

This response contains elements that indicate the multipart upload ID and the bucket and object names, which are used for uploading and assembling parts. Table 4 describes the elements.

Table 4 Response elements

Element

Type

Description

InitiateMultipartUploadResult

XML

Explanation:

Container of a multipart upload task.

Restrictions:

None

Value range:

None

Default value:

None

Bucket

String

Explanation:

Indicates the bucket name in the multipart upload.

Restrictions:

  • A bucket name must be unique across all accounts and regions.
  • A bucket name:
    • Must be 3 to 63 characters long and start with a digit or letter. Lowercase letters, digits, hyphens (-), and periods (.) are allowed.
    • Cannot be formatted as an IP address.
    • Cannot start or end with a hyphen (-) or period (.).
    • Cannot contain two consecutive periods (..), for example, my..bucket.
    • Cannot contain a period (.) and a hyphen (-) adjacent to each other, for example, my-.bucket or my.-bucket.
  • If you repeatedly create buckets of the same name in the same region, no error will be reported and the bucket attributes comply with those set in the first creation request.

Value range:

None

Default value:

None

Key

String

Explanation:

Name of the object in the multipart upload. An object is uniquely identified by an object name in a bucket. An object name is a complete path that does not contain the bucket name.

For example, if the access path is examplebucket.obs.ap-southeast-1.myhuaweicloud.com/folder/test.txt, the object name is folder/test.txt.

Restrictions:

For details, see Object Overview.

Value range:

The value must contain 1 to 1,024 characters.

Default value:

None

UploadId

String

Explanation:

ID of the multipart upload, which is used to specify a multipart upload in uploading parts

Restrictions:

None

Value range:

The value must contain 1 to 32 characters.

Default value:

None

EncodingType

String

Explanation:

Encoding type of the key of an object. If encoding-type is specified in the request, the Key in the response is encoded.

Restrictions:

None

Value range:

URL

Default value:

None. If you do not specify this parameter, encoding is not applied.

Error Responses

  1. If the AK or signature was invalid, OBS returns 403 Forbidden and the error code is AccessDenied.
  2. If the bucket was not found, OBS returns 404 Not Found and the error code is NoSuchBucket.
  3. If the user did not have the write permission for the specified bucket, OBS returns 403 Forbidden and the error code is AccessDenied.

Other errors are included in Table 2.

Sample Request: Initiating a Multipart Upload

1
2
3
4
POST /objectkey?uploads  HTTP/1.1 
Host: examplebucket.obs.region.myhuaweicloud.com
Date: WED, 01 Jul 2015 05:14:52 GMT 
Authorization: OBS AKIAIOSFODNN7EXAMPLE:VGhpcyBtZXNzYWdlIHNpZ25lZGGieSRlbHZpbmc=

Sample Response: Initiating a Multipart Upload

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 200 OK 
Server: OBS
x-obs-id-2: Weag1LuByRx9e6j5Onimru9pO4ZVKnJ2Qz7/C1NPcfTWAtRPfTaOFg== 
x-obs-request-id: 996c76696e6727732072657175657374 
Date: WED, 01 Jul 2015 05:14:52 GMT
Content-Length: 303

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<InitiateMultipartUploadResult xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/">
  <Bucket>bucketname</Bucket>  
  <Key>objectkey</Key>  
  <UploadId>DCD2FC98B4F70000013DF578ACA318E7</UploadId> 
</InitiateMultipartUploadResult>

Sample Request: Initiating a Multipart Upload (with the ACL Configured)

1
2
3
4
5
POST /objectkey?uploads  HTTP/1.1 
Host: examplebucket.obs.region.myhuaweicloud.com
Date: WED, 01 Jul 2015 05:15:43 GMT
x-obs-grant-write-acp:ID=52f24s3593as5730ea4f722483579ai7,ID=a93fcas852f24s3596ea8366794f7224
Authorization: OBS AKIAIOSFODNN7EXAMPLE:VGhpcyBtZXNzYWdlIHNpZ25lZGGieSRlbHZpbmc=

Sample Response: Initiating a Multipart Upload (with the ACL Configured)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
HTTP/1.1 200 OK 
Server: OBS
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCTnv+daB51p+IVhAvWN7s5rSKhcWqDFs 
x-obs-request-id: BB78000001648457112DF37FDFADD7AD 
Date: WED, 01 Jul 2015 05:15:43 GMT
Content-Length: 303

<?xml version="1.0" encoding="UTF-8" standalone="yes"?> 
<InitiateMultipartUploadResult xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/">
  <Bucket>bucketname</Bucket>  
  <Key>objectkey</Key>  
  <UploadId>000001648453845DBB78F2340DD460D8</UploadId> 
</InitiateMultipartUploadResult>

เราใช้คุกกี้เพื่อปรับปรุงไซต์และประสบการณ์การใช้ของคุณ การเรียกดูเว็บไซต์ของเราต่อแสดงว่าคุณยอมรับนโยบายคุกกี้ของเรา เรียนรู้เพิ่มเติม

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback