Help Center/
Object Storage Service/
SDK Reference/
Java/
FAQs (SDK for Java)/
How Can I Perform a Multipart Upload? (Java SDK)
Updated on 2024-01-16 GMT+08:00
How Can I Perform a Multipart Upload? (Java SDK)
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 Multipart Upload (SDK for Java).
Parent topic: FAQs (SDK for Java)
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
The system is busy. Please try again later.
For any further questions, feel free to contact us through the chatbot.
Chatbot