C.70 S3PutTask

Uploads an object to Amazon S3. This task requires the PEAR package Services_Amazon_S3

Table C.93: Attributes

NameTypeDescriptionDefaultRequired
keyStringAmazon S3 keyn/aYes (or defined before task call as: amazon.key)
secretStringAmazon S3 secretn/aYes (or defined before task call as: amazon.secret)
bucketStringBucket to store the object inn/aYes (or defined before task call as: amazon.bucket)
contentStringContent to store in the objectn/aYes (or source or fileset)
sourceStringWhere to read content for the object fromn/aYes (or content or fileset)
objectStringObject namen/aYes (unless fileset)
contentTypeStringContent type of the object, set to auto if you want to autodetect the content type based on the source file extensionbinary/octet-streamNo
fileNameOnlyBooleanWhether filenames should contain paths when uploaded to a bucketfalseNo

C.70.1 Example

Uploading a file

<s3put source="/path/to/file.txt" object="file.txt" bucket="mybucket"
key="AmazonKey" secret="AmazonSecret" />

You can also define "bucket, key, secret" outside of the task call:

<property name="amazon.key" value="my_key" />
<property name="amazon.secret" value="my_secret" />
<property name="amazon.bucket" value="mybucket" />

<s3put source="/path/to/file.txt" object="file.txt" />

You can also specify inline content instead of a file to upload:

<property name="amazon.key" value="my_key" />
<property name="amazon.secret" value="my_secret" />
<property name="amazon.bucket" value="mybucket" />

<s3put content="Some content here" object="file.txt" />

It also works with filesets:

<property name="amazon.key" value="my_key" />
<property name="amazon.secret" value="my_secret" />
<property name="amazon.bucket" value="mybucket" />
<s3put>
    <fileset dir="${project.basedir}">
        <include name="**/*.jpg" />
    </fileset>
</s3put>

C.70.2 Supported Nested Tags