create sub buckets on amazon s3


Hits: 2938  

Sub buckets is very tricky task to create on Amazon S3 service…

<?php

include(“S3.php”); // class for REST based S3 manager

$s3 = new S3(‘accessKey’, ‘secretKey’);
$s3->putBucket(‘bucketname’, S3::ACL_PUBLIC_READ);

/* function to upload svnlabs.txt file to subfolders s/v/n/l/a/b/s on S3 bucketname */
$s3->putObjectFile(‘svnlabs.txt’, ‘bucketname’, ‘s/v/n/l/a/b/s/svnlabs.txt’, S3::ACL_PUBLIC_READ);

/* function to delete svnlabs.txt file to subfolders s/v/n/l/a/b/s on S3 bucketname */
//$s3->deleteObject(‘bucketname’, ‘s/v/n/l/a/b/s/svnlabs.txt’);

?>

Public URL for this file:
http://bucketname.s3.amazonaws.com/s/v/n/l/a/b/s/svnlabs.txt

Source: http://undesigned.org.za/2007/10/22/amazon-s3-php-class

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch