How to create folder under Amazon S3 bucket through PHP SDK?

  1. The answer can be found here: Direct upload to s3 without the use of a production server

  2. I've never used the PHP SDK, but I was browsing through the AWS SDK for PHP 1.5.14 documentation and came across the following APIs that you will need to utilize:

    a) create_object : You'll use this to put a object into a bucket. You'll specify the filename. You asked how you can create different folders: you will include the full path into the filename. For instance instead of naming the file "photo1.jpg", you would name it "user1/vacation/photo1.jpg".

    b) get_object_list : This API will return to you a list of objects given some criteria. If you want to read all the objects from a particular folder, specify the prefix as the path to the folder. For instance, if I want to find all files in the folder "user1/vacation/", I would specify my prefix to be "user1/vacation/".


Yes , it is possible to create new folder using s3 sdk.

try bellow code

<?php

 /* abc is the folder name */

 $s3->putObject(array( 
                   'Bucket' => $bucket,
                   'Key'    => "abc/",
                   'Body'   => "",
                   'ACL'    => 'public-read'
                  ));