Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating the sub-directories inside the Amazon S3 buckets using script

I found the script for creating the buckets in the amazon s3 and maintaining the files inside that bucket in the following link.

http://net.tutsplus.com/tutorials/php/how-to-use-amazon-s3-php-to-dynamically-store-and-manage-files-with-ease/

But i want to create the sub-directories in the amazon s3 buckets and have to maintain the files inside those directories.Can any one please tell me whether that is possible using the api.If possible please tell me how?

like image 638
Kalai Avatar asked Sep 11 '12 12:09

Kalai


1 Answers

yes, it should be easy. instead of giving

$s3->putObjectFile($fileTempName, "jurgens-nettuts-tutorial", $fileName, S3::ACL_PUBLIC_READ)

just give

$folderName = 'xyz/abc/filename';  // path on s3 bucket.

$s3->putObjectFile($fileTempName,"jurgens-nettuts-tutorial" ,$folderName ,S3::ACL_PUBLIC_READ );

define the directory in foldername

like image 183
Avichal Badaya Avatar answered Nov 08 '22 13:11

Avichal Badaya