简体   繁体   中英

Upload entire folder to Amazon S3 bucket using PHP

I need to upload an entire folder of files and subfolders to an Amazon S3 bucket using PHP, does anyone know of a solution to quickly and easily accomplish this? Other libraries I've looked into appear to only support uploading individual files.

in amazon s3 folder is barely what you give an url name. virtually it creates folder based on url and why you want to use php whereas you can cli. you can upload multiple files that way ie for each file you can fire a cli command ie

s3cmd put source/source1.txt target/target1.txt

s3cmd is fabulous solution !!! but instead using php for uploading of directory use parameter with s3cmd like this: s3cmd put --recursive directory_name s3://bucket_name in terminal shell....enjoy s3cmd!!

Note: Use this s3cmd link for installation on your platform, for ubuntu lovers just type

  • sudo(for non-root) apt-get install s3cmd
  • s3cmd --configure (it prompts for your amazon access and secret key)
  • then, s3cmd ls (list all buckets)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM