I've just finished a massive overhaul of the S3 PHP Class documentation.
This update includes examples for every method (none of which have been tested). If you find any errors or inconsistencies, please drop me a line.
I've just finished a massive overhaul of the S3 PHP Class documentation.
This update includes examples for every method (none of which have been tested). If you find any errors or inconsistencies, please drop me a line.
I've created a very simple Wordpress plugin for Amazon S3 which uses my Amazon S3 PHP class.
Currently it allows you to upload files to an S3 bucket and insert them into your post when adding media.
Please note that PHP 5 and the CURL extension are required.
Download the latest version of the plugin.To install place s3uploader.php into your wp-content/plugins/ directory. After activating the plugin you will need to configure your AWS credentials under Settings - Amazon S3 and select the bucket you would like to upload to.
Planned features for upcoming releasesThis class is a standalone Amazon S3 REST implementation for PHP 5.2.x (using CURL), that supports large file uploads and doesn't require PEAR.
Download source:
Example usage (also see example.php and the class documentation):
$s3 = new S3('accessKey', 'secretKey');
$s3->putBucket('bucket', S3::ACL_PUBLIC_READ);
$s3->putObjectFile('file.doc', 'bucket', 'docs/file.doc', S3::ACL_PUBLIC_READ);
$s3->deleteObject('bucket', 'docs/file.doc');
Writing and reading resources:
# Upload an object from a resource (requires bytesize):
$s3->putObject($s3->inputResource(fopen($file, 'rb'), filesize($file)), $bucketName, $uploadName, S3::ACL_PUBLIC_READ);
# Download an object to a resource:
$s3->getObject($bucketName, $uploadName, fopen($savefile, 'wb'));
Known Issues:
More Information:
Changelog
Amazon S3™ is a trademark of Amazon.com, Inc. or its affiliates.