鉴于以下代码段,我循环并下载了一个文件数组。如果文件列表大于50个对象,那就好了,那就是它。亚马逊是否对我可以一次下载的对象数量有限制?如果是的话,是否有解决方法,或者我只是做错了?同样,一切都适用于50个以下的文件。
只是为了澄清,目的是为某人下载生成一个zip文件。文件列表可能从几个文件到几百个不等。
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);
}
}