Class PostObject
Encapsulates the logic for getting the data for an S3 object POST upload form
- Guzzle\Common\Collection implements ArrayAccess, IteratorAggregate, Countable, Guzzle\Common\ToArrayInterface
- Aws\S3\Model\PostObject
Methods summary
-
public
__construct ( Aws\S3\S3Client $client, mixed $bucket, array $options = array() )
Constructs the PostObject
-
public
prepareData ( )
Analyzes the provided data and turns it into useful data that can be consumed and used to build an upload form
-
public
setClient ( Aws\S3\S3Client $client )
Sets the S3 client
-
public
getClient ( )
Gets the S3 client
-
public
setBucket ( string $bucket )
Sets the bucket and makes sure it is a valid bucket name
-
public
getBucket ( )
Gets the bucket name
-
public
getFormAttributes ( )
Gets the form attributes as an array
-
public
getFormInputs ( )
Gets the form inputs as an array
-
public
getJsonPolicy ( )
Gets the raw JSON policy
-
protected
applyPolicy ( )
Handles the encoding, singing, and injecting of the policy
Methods detail
Constructs the PostObject
The options array accepts the following keys:
- acl: The access control setting to apply to the uploaded file. Accepts any of the CannedAcl constants
- Cache-Control: The Cache-Control HTTP header value to apply to the uploaded file
- Content-Disposition: The Content-Disposition HTTP header value to apply to the uploaded file
- Content-Encoding: The Content-Encoding HTTP header value to apply to the uploaded file
- Content-Type: The Content-Type HTTP header value to apply to the uploaded
file. The default value is
application/octet-stream
- Expires: The Expires HTTP header value to apply to the uploaded file
- key: The location where the file should be uploaded to. The default value is
^${filename}
which will use the name of the uploaded file - policy: A raw policy in JSON format. By default, the PostObject creates one for you
- policy_callback: A callback used to modify the policy before encoding and signing it. The method signature for the callback should accept an array of the policy data as the 1st argument, (optionally) the PostObject as the 2nd argument, and return the policy data with the desired modifications.
- success_action_redirect: The URI for Amazon S3 to redirect to upon successful upload
- success_action_status: The status code for Amazon S3 to return upon successful upload
- ttd: The expiration time for the generated upload form data
- x-amz-meta-*: Any custom meta tag that should be set to the object
- x-amz-server-side-encryption: The server-side encryption mechanism to use
- x-amz-storage-class: The storage setting to apply to the object
- x-amz-server-side-encryption-customer-algorithm: The SSE-C algorithm
- x-amz-server-side-encryption-customer-key: The SSE-C customer secret key
- x-amz-server-side-encryption-customer-key-MD5: The MD5 hash of the SSE-C customer secret key
For the Cache-Control, Content-Disposition, Content-Encoding, Content-Type, Expires, and key options, to use a "starts-with" comparison instead of an equals comparison, prefix the value with a ^ (carat) character
Parameters
- $client
Aws\S3\S3Client
$client- $bucket
mixed
$bucket- $options
array
$options
Overrides
Analyzes the provided data and turns it into useful data that can be consumed and used to build an upload form
Returns
Sets the bucket and makes sure it is a valid bucket name
Parameters
- $bucket
string
$bucket
Returns
Gets the bucket name
Returns
string
Gets the form attributes as an array
Returns
array
Gets the form inputs as an array
Returns
array
Gets the raw JSON policy
Returns
string
Handles the encoding, singing, and injecting of the policy
Methods inherited from Guzzle\Common\Collection
add()
,
clear()
,
count()
,
filter()
,
fromConfig()
,
get()
,
getAll()
,
getIterator()
,
getKeys()
,
getPath()
,
hasKey()
,
hasValue()
,
keySearch()
,
map()
,
merge()
,
offsetExists()
,
offsetGet()
,
offsetSet()
,
offsetUnset()
,
overwriteWith()
,
remove()
,
replace()
,
set()
,
setPath()
,
toArray()
Magic methods summary
Properties summary
protected
|
$client |
#
The S3 client being used to sign the policy |
protected
string
|
$bucket |
#
The bucket name where the object will be posted |
protected
array
|
$formAttributes |
#
The <form> tag attributes as an array |
protected
array
|
$formInputs |
#
The form's <input> elements as an array |
protected
string
|
$jsonPolicy |
#
The raw json policy |