Uploads an object to Amazon S3. This task requires the PEAR package Services_Amazon_S3
Table C.93: Attributes
Name | Type | Description | Default | Required |
---|---|---|---|---|
key | String | Amazon S3 key | n/a | Yes (or defined before task call as: amazon.key) |
secret | String | Amazon S3 secret | n/a | Yes (or defined before task call as: amazon.secret) |
bucket | String | Bucket to store the object in | n/a | Yes (or defined before task call as: amazon.bucket) |
content | String | Content to store in the object | n/a | Yes (or source or fileset) |
source | String | Where to read content for the object from | n/a | Yes (or content or fileset) |
object | String | Object name | n/a | Yes (unless fileset) |
contentType | String | Content type of the object, set to
auto if you want to autodetect
the content type based on the source file
extension | binary/octet-stream | No |
fileNameOnly | Boolean | Whether filenames should contain paths when uploaded to a bucket | false | No |
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>