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,280 points
10,903 views

1 answer to this question.

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

How do I create an alarm for my load balancer using the Amazon EC2 console?

Follow these steps: Open the Amazon EC2 console On ...READ MORE

answered May 17, 2019 in AWS by Rhea
1,307 views
+5 votes
14 answers

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

You can use the following code, import boto3 s3 ...READ MORE

answered Dec 7, 2018 in AWS by Nitesh
313,107 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,220 points
1,146 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,200 points
1,516 views
+3 votes
6 answers

Renaming files in S3

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

answered Oct 16, 2018 in AWS by petter dj
29,635 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
• 6,290 points
3,174 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
8,421 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
4,145 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP