简体   繁体   English

使用PHP将整个文件夹上传到Amazon S3存储桶

[英]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? 我需要使用PHP将整个文件夹和子文件夹上传到Amazon S3存储桶,有没有人知道快速轻松地完成此操作的解决方案? 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. 在亚马逊s3文件夹中几乎没有你提供的网址名称。 virtually it creates folder based on url and why you want to use php whereas you can cli. 几乎它创建基于URL的文件夹以及为什么要使用php,而你可以cli。 you can upload multiple files that way ie for each file you can fire a cli command ie 您可以通过这种方式上传多个文件,即每个文件都可以发出cli命令,即

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

s3cmd is fabulous solution !!! s3cmd是绝妙的解决方案! 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!! 而是使用PHP与这样s3cmd目录,使用参数上传: s3cmd put --recursive directory_name s3://bucket_name在终端外壳....享受s3cmd!

Note: Use this s3cmd link for installation on your platform, for ubuntu lovers just type 注意:使用此s3cmd链接在您的平台上安装,对于ubuntu爱好者只需键入

  • sudo(for non-root) apt-get install s3cmd sudo(非root用户)apt-get install s3cmd
  • s3cmd --configure (it prompts for your amazon access and secret key) s3cmd --configure(它会提示您输入亚马逊密钥和密钥)
  • then, s3cmd ls (list all buckets) 然后,s3cmd ls(列出所有桶)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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