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,750 points
810 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
• 56,520 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,560 points
90 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 in AWS by Ravish
33 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
386 views
+1 vote
4 answers

Can a URL be directly uploaded to S3 using POST?

You can read this blog and get ...READ MORE

answered Oct 25, 2018 in AWS by chamunda
62 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
• 56,520 points
229 views
0 votes
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
• 56,520 points
448 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,560 points
303 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 9, 2018 in AWS by Priyaj
• 56,520 points
157 views