All Products
Search
Document Center

Object Storage Service:Upload objects using OSS SDK for Go 2.0

Last Updated:Jun 17, 2026

OSS SDK for Go V2 provides multiple upload operations. Choose the one that best fits your scenario.

Type

Operation

Description

Simple upload

Client.PutObject

  • Uploads an object up to 5 GiB in size.

  • Supports CRC-64 (enabled by default).

  • Displays upload progress.

  • Accepts an io.Reader request body. If the request body also implements io.Seeker, the upload is automatically retried on failure.

Client.PutObjectFromFile

  • Provides the same capability as Client.PutObject.

  • Reads the request body from a local file path.

Append upload

Client.AppendObject

  • Appends data to an object up to 5 GiB in size.

  • Supports CRC-64 (enabled by default).

  • Displays upload progress.

  • Accepts an io.Reader request body. If the request body also implements io.Seeker, the upload is automatically retried on failure. The operation is idempotent, but retries may still fail.

AppendOnlyFile operations

AppendOnlyFile.Write

AppendOnlyFile.WriteFrom

  • Provides the same capability as Client.AppendObject.

  • Improves fault tolerance for retry failures.

Multipart upload

Multipart upload operations

Client.InitiateMultipartUpload

Client.UploadPart

Client.CompleteMultipartUpload

  • Uploads an object up to 48.8 TiB in size, with each part up to 5 GiB.

  • UploadPart supports CRC-64 (enabled by default).

  • UploadPart displays upload progress.

  • Accepts an io.Reader request body. If the request body also implements io.Seeker, the upload is automatically retried on failure.

Form upload

/

  • Generates a signature and upload policy, and uploads an object to OSS by using HTTP POST.

A signed URL

Client.Presign

  • Generates a time-limited signed URL that authorizes HTTP PUT uploads.

Uploader

Uploader.UploadFrom

  • Wraps simple upload and multipart upload to upload an object up to 48.8 TiB in size.

  • Supports CRC-64 (enabled by default).

  • Displays upload progress.

  • Accepts an io.Reader request body. If the request body also implements io.Seeker and io.ReaderAt, data is streamed without memory caching. Otherwise, data is cached in memory before upload.

Uploader.UploadFile

  • Provides the same capability as Uploader.UploadFrom.

  • Reads the request body from a local file path.

  • Supports resumable upload.