How do I create folder under an Amazon S3 bucket through PHP API?

0 votes
I am developing an iPhone app to allow a user upload photo and share it.
I want to use S3 to store upload the images as well as process the images (for example, thumbnail, reduced size image).
I've installed AWS PHP API on my EC2 instance, my questions are: 1) Should photo uploaded from iPhone app go to an EC2 directory first, then copy them over to S3 bucket, or it should directly get uploaded to S3?
2) How can I create different folders under the S3 bucket through PHP API and how to read the files from the folder?

Kindly help me out in this case, will be grateful!
Apr 24, 2018 in AWS by Flying geek
• 3,130 points
1,761 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

Of Course, it is possible to create a new folder using s3 SDK.

Try this code below: 

<?php

 /* abc is the folder name */

 $s3->putObject(array( 
                   'Bucket' => $bucket,
                   'Key'    => "abc/",
                   'Body'   => "",
                   'ACL'    => 'public-read'
                  ));
answered Apr 24, 2018 by anonymous

Related Questions In AWS

0 votes
1 answer
+1 vote
11 answers

Python AWS Boto3: How do i read files from S3 Bucket?

All of the answers are kind of ...READ MORE

answered Mar 30 in AWS by awsdbaexpert
• 200 points
17,220 views
0 votes
1 answer
+1 vote
2 answers

Scp Php files into server using gradle

Tru something like this: plugins { id ...READ MORE

answered Oct 11, 2018 in DevOps & Agile by lina
• 8,100 points
71 views
+4 votes
5 answers

Usage of Amazon Cloudfront or S3

When to use S3? S3 is like many ...READ MORE

answered Apr 3, 2018 in AWS by brat_1
• 7,080 points
70 views
+3 votes
5 answers

Renaming files in S3

You can either use AWS CLI or ...READ MORE

answered Oct 16, 2018 in AWS by petter dj
458 views
0 votes
1 answer

S3 Static Website Hosting Route All Paths to Index.html

Yes there is an easy way to ...READ MORE

answered Apr 8, 2018 in AWS by code_ninja
• 5,920 points
180 views
+1 vote
4 answers

How do I cache my images which are stored in Amazon S3?

when caching ec2 instance these can be ...READ MORE

answered Oct 23, 2018 in AWS by Nabarupa
315 views
0 votes
1 answer

How do I write an S3 Object to a file?

While IOUtils.copy() and IOUtils.copyLarge() are great, I would prefer the old ...READ MORE

answered Jul 13, 2018 in AWS by Hammer
• 360 points
52 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.