mrkeck Sharing the Love


Amazon S3 Upload Directory Including Itself Using PHP SDK

//Upload directory into s3 directory
//Ex. 2013/01/02/test.jpg
//$bucket = 'myBucket';
//$dirToUpload = '2013';
//$uploadDir = '2013';
//$client->uploadDirectory($dirToUpload, $bucket . '/' . $uploadDir);
//In S3 you have 2013/01/02/test.jpg
//If you didn't add the /directory to the bucket would get 01/02/test.jpg
$bucket = 'myBucket';
$dirToUpload = 'C:/someDir/localDir';
$uploadDir = 's3Dir';  //Could be the same as $dirToUpload but you can change name too
$response = $client->uploadDirectory($dirToUpload, $bucket . '/' . $uploadDir);
Filed under: Amazon, PHP, S3 Leave a comment
Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.