Online User
Online User

Reputation: 17618

Upload a large folder to Amazon S3

I know how to upload one single file to Amazon S3, I use this:

 <?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>";
}?>

I have a large 1TB directory of videos I want to upload them on Amazon S3.

I tried to loop recursively through each directory and upload each file alone, but it failed. Its just that too many bugs will occur due to file naming, server timeout issues, etc...

I want the bucket to mirror my exact directory structure. The folder I want to copy is held on a dedicated server serving Apache.

Is there a way I could just upload the folder through the API? It is also 1TB, so what's the best solution?

Upvotes: 2

Views: 2627

Answers (1)

Related Questions