How Can I Perform a Multipart Upload?
In a multipart upload, you can specify a part of the file to be uploaded by performing the following steps:
- You need to initialize an instance of ObsClient by using AK, SK, and endpoint.
- Specify the bucket name and object name to initialize InitiateMultipartUploadRequest. Call InitiateMultipartUploadRequest.setMetadata to set the metadata of the object to be uploaded. Then, call ObsClient.initiateMultipartUpload to initialize a multipart upload task. A globally unique identifier (upload ID) is returned to identify this task.
- Specify the bucket name and object name to initialize UploadPartRequest. Call UploadPartRequest.setUploadId to set the upload ID to which the part to be uploaded belongs; call setPartNumber to set the part number of the part; call setFile to set the large file to which the part belongs; call setPartSize to set the part size; and then call ObsClient.uploadPart to upload the part. The ETag value of the uploaded part is returned.
- After all parts are uploaded, specify the bucket name, object name, uploadId, and partEtags to initialize a CompleteMultipartUploadRequest request. Then, call ObsClient.completeMultipartUpload to merge parts.
For details, see Performing a Multipart Upload.
Last Article: How Do I Stop an Ongoing Upload Task?
Next Article: How Can I Perform a Download in Multipart Mode?
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.