PHP and AWS | Copy AWS S3 file to local folder

Author - Ashish
14.02.2017
|
0 Comments
|

How to copy a file from Amazon s3 to some local folder using PHP code

$t=file_put_contents(‘[Destination file address]’, file_get_contents(“[S3 url]”));

Here $t will get the size of file in bytes if successful otherwise 0. Before executing this make sure that the S3 file has access permission and the destination file also has write permission.

S3 url is like https://s3.ap-south-1.amazonaws.com/[bucket]/[filename]

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *

Send your message