Uploading an Object Using the PUT Method

Uploading an object is to add an object to a bucket. This operation requires the write permission. Objects uploaded by users are stored in buckets. Only the users who have the write permission can upload objects to buckets.

The name of each object in a bucket must be unique. If you upload an object with the same key as an existing object in the bucket, the new object will replace the existing object. To ensure that no data is corrupted during transmission, you can specify the value of the Content-MD5 parameter in the request header. After receiving the request, the OBS will perform an MD5 consistency check. If the two MD5 values are inconsistent, the system returns an error message. You can also specify the value of the x-obs-acl parameter to configure an access control policy for the object.

After creating a bucket in OBS, you can upload an object to the bucket using the PUT method.

If a bucket has versioning enabled, the system automatically generates a unique version ID for the requested object in this bucket and returns the version ID in response header x-obs-version-id. If versioning is suspended for the bucket, the object version number is null.

The format of a PUT upload request is as follows:

PUT /ObjectName HTTP/1.1 
Host: Host Server 
Content-Type: type 
Content-Length: length 
Authorization: authorization 
Date: date 
<Optional Additional Header> 
<object Content>