POST Object

The POST Object operation adds an object to a specified bucket using HTML forms.

Note:

POST is an alternate form of PUT that enables browser-based uploads as a way of putting objects in buckets. Parameters that are passed to PUT in HTTP Headers are instead passed as form fields to POST in the multipart-form-data encoded message body. WRITE access is required to add an object to a bucket. To ensure that data is not corrupted traversing the network, use the Content-MD5 form field. When you use this form field, S3 checks the object against the provided MD5 value. If they do not match, S3 returns an error. Additionally, you can calculate the MD5 value while posting an object to S3 and compare the returned ETag to the calculated MD5 value. The ETag only reflects changes to the contents of an object, not its metadata.

Syntax Example

For request syntax examples, see POST Object.

Request Parameters

This implementation of the POST Object operation does not support the use of request parameters.

Request Headers

This implementation of the POST Object operation does not support the use of request headers.

Request Elements

The request is made through an HTTP form.

Form Field Names Supported In Request

The POST Object operation supports the use of following form fields in a request.

Note:

Server-side encryption form fields are not supported.
Field Name Field Name

AWSAccessKeyId

policy

acl

success_action_redirect

Cache-Control, Content-Type, Content-Disposition, Content-Encoding, Expires

success_action_status

file

tagging

key

x-amz-storage-class

x-amz-meta-*

 

For a description of these supported form fields, see POST Object.

Response Headers

In addition to the response headers common to all responses, this implementation of the POST Object operation can include the following response headers:

  • success_action_redirect

  • x-amz-version-id

For a more information about these response headers, see POST Object. For a description of common response headers, see table "Supported Response Headers" in Supported Common Response Headers.

Response Elements

For a list of supported elements in the XML response for the POST Object operation, see POST Object.

Expected HTTP Error Response Codes

200 or 201 or 204

Error Response Code

The POST Object API does not return special errors. For general information about S3 errors and a list of error codes, see S3 Client Error Handling Reference.

Example

POST / HTTP/1.1
User-Agent: browser_data
Accept: file_types
Accept-Language: Regions
Accept-Encoding: encoding
Accept-Charset: character_set
Keep-Alive: 300
Connection: keep-alive
Content-Type: multipart/form-data; boundary=9431149156168
Content-Length: length

--9431149156168
Content-Disposition: form-data; name="key"

acl
--9431149156168
Content-Disposition: form-data; name="tagging"

<Tagging><TagSet><Tag><Key>Tag Name</Key><Value>Tag Value</Value></Tag></TagSet></Tagging>
--9431149156168
Content-Disposition: form-data; name="success_action_redirect"

success_redirect
--9431149156168
Content-Disposition: form-data; name="Content-Type"

content_type
--9431149156168
Content-Disposition: form-data; name="x-amz-meta-uuid"

uuid
--9431149156168
Content-Disposition: form-data; name="x-amz-meta-tag"

metadata
--9431149156168
Content-Disposition: form-data; name="AWSAccessKeyId"

access-key-id
--9431149156168
Content-Disposition: form-data; name="Policy"

encoded_policy
--9431149156168
Content-Disposition: form-data; name="Signature"

signature=
--9431149156168
Content-Disposition: form-data; name="file"; filename="MyFilename.jpg"
Content-Type: image/jpeg

file_content
--9431149156168
Content-Disposition: form-data; name="submit"

Upload to S3
--9431149156168--

response:
HTTP/1.1 100 Continue
HTTP/1.1 200 OK
x-amz-request-id: tx0A49CE4060975EAC
x-amz-version-id: null
Date: Wed, 01 Mar  2018 12:00:00 GMT
ETag: "828ef3fdfa96f00ad9f27c383fc9ac7f"
Content-Length: 0
Connection: close
Server: Apache