Uploading an Object Using PUT

Each object must have a unique name in a bucket. If you upload an object with the same name 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, 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-amz-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 the bucket versioning state is set to Enabled, the system will automatically generate a unique version ID for the object and returns the version ID in the response header x-amz-version-id. If the bucket versioning state is set to Suspended, the version ID of the object is null.

The format of a PUT request that uploads an object is as follows:

PUT /ObjectName HTTP/1.1   
Host: bucketname.obs.cn-north-1.myhwclouds.com   
Content-Type: type   
Content-Length: length   
Authorization: authorization   
Date: date   
<Optional Additional Header>   
<object Content>