-3

On my website, I have an upload directory, with an upload.html page. I want to be able to send the upload to an external CDN, which is an AWS bucket. According to this post, it can't be done using PHP, however I was wondering if I could do this using Python. I don't have any code, because I have no idea where to start. Maybe I can interact with the AWS CLI using Python?

Thanks for any help.

altude
  • 41
  • 6

1 Answers1

0

You can do it with AWS PHP SDK as well you just sync the uploaded files to S3 Bucket

$client = S3Client:::factory(array(
  'key' => 'your-aws-access-key-id',
    'secret'    => 'your-aws-secret-access-key'

));

$client->uploadDirectory('/local/directory', 'my_bucket');
  1. https://www.codementor.io/@limormaayan/data-sync-to-aws-s3-overview-and-best-practices-eptvrh6ju
  2. https://docs.aws.amazon.com/aws-sdk-php/v2/api/namespace-Aws.S3.Sync.html
Nitin Goyal
  • 497
  • 4
  • 16