BatchPut for Amazon S3 in PHP 5

Sample Code & Libraries>BatchPut for Amazon S3 in PHP 5
Community Contributed Software

  • Amazon Web Services provides links to these packages as a convenience for our customers, but software not authored by an "@AWS" account has not been reviewed or screened by AWS.
  • Please review this software to ensure it meets your needs before using it.

Straightforward PHP 5 class, with no external dependencies, that does one job well: recursively uploading a directory tree of files to S3 in parallel.


Submitted By: Clay Loveless
AWS Products Used: Amazon S3
Language(s): PHP
License: New BSD
Source Control Access:
Created On: March 31, 2009 10:11 PM GMT
Last Updated: April 24, 2009 4:14 PM GMT

Batch Uploads in Parallel

Leverage the power of parallel requests to get a ton of data into S3 quickly using this straightforward PHP 5 class. Example usage:


// assumes PEAR-compatible include_path installation
require_once 'Killersoft/Service/Amazon/S3/BatchPut.php';

// from
$source = "/path/to/my/stuff";
// to
$dest   = "my-bucket/stuff";

// see source code for additional credential
// population options
$put = new Killersoft_Service_Amazon_S3_BatchPut(

// oooh, fluid interface!
$results = $put->setSourceDir($source)

// will contain response headers, body,
// AND curl_getinfo() data for each
// file

// Got errors? See what's up
if ($put->hasErrors()) {

Reviews and critique welcomed! My intention is to support this class going forward, and your feedback will help.



notices, failures and fatals
What I get when I do as we are told: Notice: Undefined variable: content_type in /root/amazon_s3/BatchPut.php on line 719 Notice: Undefined variable: content_type in /root/amazon_s3/BatchPut.php on line 738 [response] => HTTP/1.1 403 Forbidden Fatal error: Call to undefined method Killersoft_Service_Amazon_S3_BatchPut::hasErrors() in /root/amazon_s3/test.php on line 20 Is this a proof of concept or do you intend usefulness? Do I have to create that bucket myself? How? Changing the call to hasErrors to getErrors gives me an empty error result set. Why? There are errors obviously.
aksbbkkii on May 27, 2009 5:21 PM GMT
We are temporarily not accepting new comments.
©2017, Amazon Web Services, Inc. or its affiliates. All rights reserved.