将大文件夹上传到Amazon S3

时间:2014-12-21 23:02:05

标签: php amazon-web-services amazon-s3

我知道如何将一个文件上传到Amazon S3,我使用它:

 <?php
//include the S3 class
if (!class_exists('S3'))
    require_once('S3.php');
//AWS access info
$s3 = new S3(awsAccessKey, awsSecretKey);
if ($s3->putObjectFile("movie.mp4", "mybucket", "movie-on-aws.mp4", S3::ACL_PUBLIC_READ)) {
    echo "<strong>We successfully uploaded your file.</strong>";
} else {
    echo "<strong>1 Something went wrong while uploading your file... sorry.</strong>";
}?>

我有一个大型的1TB视频目录,我想在Amazon S3上上传。

我试图以递归方式遍历每个目录并单独上传每个文件,但它失败了。只是由于文件命名,服务器超时问题等原因会发生太多错误......

我希望存储桶能够镜像我确切的目录结构。我要复制的文件夹保存在为Apache提供服务的专用服务器上。

有没有办法可以通过API上传文件夹?它也是1TB,那么最好的解决方案是什么?

1 个答案:

答案 0 :(得分:2)