Uploading a Part
API Description
After a multipart upload is initialized, you can use this API to upload a part to a specified bucket by using the multipart upload ID. Except for the part last uploaded whose size ranges from 0 to 5 GB, sizes of the other parts range from 100 KB to 5 GB. The upload part ID ranges from 1 to 10000.
Method Definition
func (obsClient ObsClient) UploadPart(input *UploadPartInput) (output *UploadPartOutput, err error)
Method Definition If a Signed URL Is Used
func (obsClient ObsClient) UploadPartWithSignedUrl(signedUrl string, actualSignedRequestHeaders http.Header, data io.Reader) (output *UploadPartOutput, err error)
Request Parameters
| Field | Type | Optional or Mandatory |
|---|---|---|
| input | Mandatory |
Returned Results
| Field | Type |
|---|---|
| output | |
| err | error |
Sample Code
func main() { input := &obs.UploadPartInput{} input.Bucket = "bucketname" input.Key = "objectkey" input.UploadId = "uploadid" input.PartNumber = 1 input.Body = strings.NewReader("Hello OBS") output, err := obsClient.UploadPart(input) if err == nil { fmt.Printf("RequestId:%s\n", output.RequestId) fmt.Printf("ETag:%s\n", output.ETag) } else { if obsError, ok := err.(obs.ObsError); ok { fmt.Println(obsError.Code) fmt.Println(obsError.Message) } else { fmt.Println(err) } } }
Last Article: Initializing a Multipart Upload
Next Article: Combining Parts
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.