All Products
Search
Document Center

Object Storage Service:Upload an object (Go SDK V2)

Last Updated:Aug 02, 2025

Object Storage Service (OSS) SDK for Go V2 provides various upload operations. You can select suitable operations to upload an object based on your business scenarios.

Type

Interface Name

Description

Simple upload

Client.PutObject

  • Perform simple upload to upload an object that is up to 5 GiB in size.

  • Support CRC-64 (enabled by default).

  • Support for progress bar charts.

  • Support the request body whose type is io.Reader. If the type of the request body is io.Seeker, when the upload task fails, the object is reuploaded.

Client.PutObjectFromFile

  • Provide the same capability as Client.PutObject.

  • Obtain the request body from the path of the local file.

Append upload

Client.AppendObject

  • Perform append upload to upload an object that is up to 5 GiB in size.

  • Support CRC-64 (enabled by default).

  • Support for progress bar charts

  • Support the request body whose type is io.Reader. If the type of the request body is io.Seeker, when the upload task fails, the object is reuploaded. The operation is idempotent and object reupload may fail.

AppendOnlyFile operations

AppendOnlyFile.Write

AppendOnlyFile.WriteFrom

  • Provide the same capability as Client.AppendObject.

  • Optimize fault tolerance after the object reupload fails.

Multipart upload

Multipart upload operations

Client.InitiateMultipartUpload

Client.UploadPart

Client.CompleteMultipartUpload

  • Perform multiple part upload to upload an object that is up to 48.8 TiB in size and set the size of a part to up to 5 GiB.

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

  • UploadPart lets you view the progress of an upload task in the progress bar.

  • Support the request body whose type is io.Reader. If the type of the request body is io.Seeker, when the upload task fails, the object is reuploaded.

Form upload

/

  • Generate information such as a signature and an upload policy, and use the HTTP Post method to upload an object to OSS.

Uploading an object using a signed URL (Go SDK V2)

Client.Presign

  • Generate a signed URL that allows HTTP PUT requests and has a validity period to authorize users to upload an object.

Uploader

Uploader.UploadFrom

  • Encapsulate the simple upload and multipart upload operations and allow you to upload an object that is up to 48.8 TiB in size.

  • Support CRC-64 (enabled by default).

  • Support for progress bars

  • Support the request body whose type is io.Reader. If the io.Reader, io.Seeker, and io.ReaderAt types of the request body are supported, data do not need to be cached in memory. Otherwise, data must be cached in memory and then be uploaded.

Uploader.UploadFile

  • Provide the same capability as Uploader.UploadFrom.

  • Obtain the request body from the path of the local file.

  • Support resumable upload.