S3 restrictions on quantity of object downloads

72 views Asked by At

Given the following snippet, I'm looping through and downloading an array of files. It appears if the file list is greater than 50 objects, well, that's it. Does Amazon have a limit on the number of objects I can download at one time? if so, is there a work around or am i just doing this wrong? Again, everything works fine for under 50 files.

Just to clarify, the intent is to generate a zip file for someone to download. the file list could vary from a couple of files to hundreds.

 if ($zip->open($path, ZipArchive::CREATE)){
            foreach($sheets as $sheet){
                // the saved file name as it exists on the server...
                $keyname = $sheet.".pdf";

                // the new name of the file, what it was originaly uploaded as
                $sql = "SELECT * FROM files WHERE id=$sheet";
                if ($result = $mysqli->query($sql)) {
                    while($row = $result->fetch_assoc()) {
                        $saveas = $row['number']."-".$row['name'].".pdf";
                    }
                }

                // Save object locally (downloads directory) to a file.
                $filepath = "/var/www/html/downloads/".$saveas;
                $result = $client->getObject(array(
                    'Bucket' => $bucket,
                    'Key'    => $keyname,
                    'SaveAs' => $filepath
                ));
                // insert the recently saved file to the zip
                $zip->addFile($filepath, $saveas);
            }
        }
0

There are 0 answers