what php API can be used to upload and download files to Amazon S3

0 votes
I have a website hosted on amazon. I want my clients to give access to upload files that are already in their amazon s3 space to my s3 space. Is there any php API that supports this functionality?
Oct 17, 2018 in AWS by findingbugs
• 4,780 points
4,297 views

1 answer to this question.

0 votes

Amazon have a PHPSDK , check the sample code

// The sample code below demonstrates how Resource APIs work


$aws = new Aws($config);

// Get references to resource objects



$bucket = $aws->s3->bucket('my-bucket');

$object = $bucket->object('image/bird.jpg');

// Access resource attributes


echo $object['LastModified'];

// Call resource methods to take action


$object->delete();

$bucket->delete();

Or use old s3.php for uploading files to s3 bucket. its a single php file named s3.php You just download that and from your code . for more read this.

<?php


if (!class_exists('S3'))require_once('S3.php');
//AWS access info
if (!defined('awsAccessKey')) define('awsAccessKey', 'YourAccess S3 Key');
if (!defined('awsSecretKey')) define('awsSecretKey', 'Yor Secret Key');
//instantiate the class
$s3 = new S3(awsAccessKey, awsSecretKey);
$s3->putBucket("bucket name", S3::ACL_PRIVATE);

//move the file
if ($s3->putObjectFile("your file name in the server with path", "which bucket ur using (bucket name)", "fine name in s3 server", S3::ACL_PRIVATE)) {

//s3 upload success

}
?>
answered Oct 17, 2018 by Priyaj
• 58,100 points

Related Questions In AWS

+1 vote
1 answer

What tools can be used to spin-up servers on AWS?

Yes. There are a lot of tools ...READ MORE

answered Dec 19, 2018 in AWS by Archana
• 5,640 points
1,580 views
0 votes
1 answer

What are the services that can be used with Amazon VPC?

Almost all the services provided by AWS ...READ MORE

answered Mar 5, 2019 in AWS by Ravish
717 views
0 votes
1 answer

What programming languages or platforms can I use to access Amazon Kinesis API?

These are the list of languages supported: C++ Go Java JavaSc ...READ MORE

answered Nov 19, 2019 in AWS by Aleesha
1,052 views
+1 vote
5 answers

Can Celery be used with Amazon SQS

I regenerated the credentials in the IAM ...READ MORE

answered Oct 25, 2018 in AWS by triedntested
3,930 views
0 votes
1 answer

AWS S3 uploading hidden files by default

versioning is enabled in your bucket. docs.aws.amazon.com/AmazonS3/latest/user-guide/….... the ...READ MORE

answered Oct 4, 2018 in AWS by Priyaj
• 58,100 points
5,916 views
–1 vote
1 answer

How to decrypt the encrypted S3 file using aws-encryption-cli --decrypt

Use command : aws s3 presign s3://mybucket/abc_count.png you get ...READ MORE

answered Oct 22, 2018 in AWS by Priyaj
• 58,100 points
5,179 views
0 votes
1 answer

Import my AWS credentials using python script

Using AWS Cli  Configure your IAM user then ...READ MORE

answered Nov 16, 2018 in AWS by Jino
• 5,820 points
2,847 views
0 votes
2 answers
0 votes
1 answer

What is the difference between Amazon Cloudfront and S3

major difference is that cloudfront allows you ...READ MORE

answered Jul 10, 2018 in AWS by Priyaj
• 58,100 points
1,795 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