Upload entire folder to Amazon S3 trash using PHP

I need to upload an entire folder with files and subfolders into an Amazon S3 bucket using PHP, does anyone know of a solution to quickly and easily do this? Other libraries that I looked at only support downloading individual files.

+4
source share
2 answers

in the amazon s3 folder, you hardly specify the name of the url. it actually creates a url-based folder and why you want to use php while you can cli. You can upload multiple files this way. ie for each file you can run the cli ie command

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

+2
source

s3cmd is an awesome solution !!! but instead, using php to load the directory, use the parameter with s3cmd as follows: s3cmd put --recursive directory_name s3://bucket_name in the terminal shell .... enjoy s3cmd !!

Note. Use this s3cmd link to install on your platform, for ubuntu lovers just type

  • sudo (for non-root) apt-get install s3cmd
  • s3cmd --configure (it asks for your access to Amazon and the secret key)
  • then, s3cmd ls (list of all buckets)
0
source

All Articles