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
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
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
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
Huawei Cloud Astro Canvas
Huawei Cloud Astro Zero
CodeArts Governance
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 (CCI)
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
Cloud Transformation
Well-Architected Framework
Cloud Adoption Framework
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
Blockchain
Blockchain Service
Web3 Node Engine Service
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Uploading Multipart

Updated on 2025-03-21 GMT+08:00

To upload a large file, multipart upload is recommended. Multipart upload is applicable to many scenarios, including:

  • Files to be uploaded are larger than 100 MB.
  • The network condition is poor, and the connection to the storage server such as OBS is frequently disconnected.
  • Sizes of files to be uploaded are uncertain.

Multipart upload consists of three steps:

  1. Initializing a Multipart Upload Task: creates a multipart upload task.
  2. Uploading Parts.
  3. Completing Multipart Upload or Terminating (Canceling) a Multipart Upload Task.

    After the upload is complete, the file is stored in the bucket. If you terminate (cancel) a multipart upload task, all uploaded parts will be discarded.

Initializing a Multipart Upload Task

  • Function

    Before uploading data in multipart mode, you must create an initial multipart upload task. This operation will return a globally unique identifier (uploadId) of the task to identify the multipart upload task. You can use the identifier to initiate subsequent operations, such as uploading a multipart upload task, merging parts to complete the upload, and terminating (cancelling) the multipart upload task.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/createmultipartupload?object=X

    Table 1 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters
    Table 2 Request header parameters

    Header Field

    Mandatory

    Type

    Description

    Content-Type

    Yes

    String

    Explanation

    Media type of the file to be uploaded. The value must be the same as the file name. For example, if the file name is test.mp4, the value of Content-Type is video/mp4.

    Constraints

    None

    Value

    None

    Default value

    None

  • Response Parameters
    Table 3 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, Success is returned. In other cases, an error message is returned.

    result

    Object

    Explanation

    Object of the created multipart task is returned. The object contains the uploadId field, which indicates the globally unique identifier of the task and is used to identify the multipart upload task. You can use the identifier to initiate subsequent operations, such as uploading a multipart upload task, merging parts to complete the upload, and terminating (canceling) the multipart upload task.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. Call the following request to initialize the multipart upload task:

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/createmultipartupload?object=a/b/c/test.mp4
  • Example Response
    {
    	"resCode": "0",
    	"resMsg": "Success",
    	"result": {
    		"uploadId": "0000017B761***8FF0F75F13"
    	}
    }

    Record the value of uploadId, which is used to identify the multipart upload task and will be used in subsequent operations.

Uploading Parts

  • Function

    After Initializing a Multipart Upload Task, you can upload data by part based on the specified object file name and uploadId. Each uploaded part has a part number, which ranges from 1 to 10000. For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file. If new data is uploaded using the same part number, the existing data of the part number on the storage server will be overwritten. Except for the last part, the sizes of other parts must be greater than 5 MB. The maximum size of each part is not limited by OBS and MINIO. When this API is called through Huawei Cloud Astro Zero, the maximum size of all parts is 100 MB. Parts can be uploaded in sequence or even on different processes or machines. The storage server sorts the parts by part number to form the final object.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/uploadpart?object=X&uploadId=Y&partNumber=Z

    Table 4 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

    partNumber

    Yes

    Number

    Explanation

    Part number

    For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file.

    Constraints

    None

    Value

    1–10000

    Default value

    None

  • Request Parameters

    Body type in the request. The file part is uploaded in the application/octet-stream format.

  • Response Parameters
    Table 5 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, Success is returned. In other cases, an error message is returned.

    result

    Object

    Explanation

    Returned multipart task object, which contains the following fields:

    • ETag: identifier of a file part, which is used for subsequent upload.
    • partNumber: part number, which is used for subsequent upload.
  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. The multipart upload task whose uploadId is 0000017B761F112966C45D8FF0F75F13 has been initialized. Call the following request to create a multipart upload task and upload the test.mp4 file whose part number is 1.

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/uploadpart?object=a/b/c/test.mp4&uploadId=0000017B761F112966C45D8FF0F75F13&partNumber=1

    In the request body, set the object in the application/octet-stream format, that is, the file data to be uploaded.

  • Example Response
    {
    	"resCode": "0",
    	"resMsg": "Success",
    	"result": {
    		"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
    		"partNumber": 1
    	}
    }

    Record the values of ETag and partNumber, which will be used during the upload.

Completing Multipart Upload

  • Function

    After all parts are uploaded, you need to call the upload completion API to merge parts on the storage server (for example, OBS) to generate the final object file. After the upload is complete, you need to provide a list of all valid parts (including partNumber and ETag). After receiving the submitted part list, Huawei Cloud Astro Zero verifies the validity of each part one by one. After all parts pass the verification, these parts are combined into the final object. The merged multipart tasks can have inconsecutive part numbers.

    After the upload is complete, uploadId becomes invalid and cannot be used to terminate (cancel) the multipart upload.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/completeupload?object=X&uploadId=Y

    Table 6 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters
    Array type. Each element contains the fields listed in Table 7.
    Table 7 Request parameters

    Parameter

    Mandatory

    Type

    Description

    ETag

    Yes

    String

    Explanation

    Identifier of a file part. Obtain the value from the result returned by Uploading Parts.

    Constraints

    None

    Value

    None

    Default value

    None

    partNumber

    Yes

    String

    Explanation

    Part number

    For the same multipart upload task (with the same uploadId), partNumber not only uniquely identifies a part of data, but also identifies its relative location in the object file. Obtain the value from the returned result in Uploading Parts.

    Constraints

    None

    Value

    1–10000

    Default value

    None

  • Response Parameters
    Table 8 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, Success is returned. In other cases, an error message is returned.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. There are two multipart upload tasks, and uploadId is 0000017B761F112966C45D8FF0F75F13. Call the following request to complete the multipart upload task and merge all parts to generate the final object file.

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/completeupload?object=a/b/c/test.mp4&uploadId=0000017B761F112966C45D8FF0F75F13
    
    
    [{
    	"ETag": "\"d41d8cd98f00b204e9800998ecf8427e\"",
    	"partNumber": 1
    }, {
    	"ETag": "\"7dcad0c8a7398333ff25418bad511581\"",
    	"partNumber": 2
    }]
  • Example Response
    {
    	"resCode": "0",
    	"resMsg": "Success"
    }

Terminating (Canceling) a Multipart Upload Task

  • Function Description

    After a multipart upload task is canceled, you cannot use its uploadId to perform any operation and the uploaded parts will be deleted.

    When a file is being uploaded in multipart mode or fails to be uploaded, parts are generated in the bucket. These parts occupy storage space. You can cancel the multipart upload to delete unnecessary parts to save storage space.

  • URI

    POST Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/{connector_type}/{connector_name}/abortupload?object=X&uploadId=Y

    Table 9 URI parameters

    Parameter

    Mandatory

    Type

    Description

    connector_type

    Yes

    String

    Explanation

    Type of a connector.

    Constraints

    None

    Value

    • obs: connector for interconnecting with OBS.
    • minio: connector for connecting to MINIO.
    • objectstorageproxy: object storage proxy type.

    Default value

    None

    connector_name

    Yes

    String

    Explanation

    Name of the connector instance, that is, the connector instance name set when the connector is created.

    Constraints

    None

    Value

    None

    Default value

    None

    object

    Yes

    String

    Explanation

    Full path of the file to be uploaded in the bucket, including the file name, file type, and upload path. If no path is specified, the file is uploaded to the root directory of the bucket.

    For example, if the value is a/b/c/test.mp4, the test.mp4 file is uploaded to the a/b/c path of the bucket. If the path does not exist in the bucket, it will be created.

    Constraints

    None

    Value

    None

    Default value

    None

    uploadId

    Yes

    String

    Explanation

    Identifier of the multipart upload task. You can obtain the value from the returned result of Initializing a Multipart Upload Task.

    Constraints

    None

    Value

    None

    Default value

    None

  • Request Parameters

    None

  • Response Parameters
    Table 10 Response parameters

    Parameter

    Type

    Description

    resCode

    String

    Explanation

    Return code.

    Value

    If the request is successful, 0 is returned. For details about other error codes, see Error Codes.

    resMsg

    String

    Explanation

    Message returned.

    Value

    If the request is successful, Success is returned. In other cases, an error message is returned.

  • Example Request

    An OBS connector has been created. The connector instance name is Namespace_TestOBS. Large files need to be uploaded to the a/b/c path of the OBS bucket. If the uploadId is 0000017B76500F0662CABA7128913936, call the following request to cancel the multipart upload task:

    POST https://Huawei Cloud Astro Zero domain name/u-route/baas/sys/v1.1/connectors/obs/Namespace __TestOBS/abortupload?object=a/b/c/test3.mp4&uploadId=0000017B76500F0662CABA7128913936
  • Example Response
    {
    	"resCode": "0",
    	"resMsg": "Success"
    }

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback