I am trying to download the large files from the AWS S3 with the getObject method. But for large files the page gets down. How i can use the range to download the file completely in parts?
function DownloadContent($keyName) {
$store = array();
require(__DIR__ . '/../config/s3Config.php');
if (!$this->s3Client) {
$this->s3Client = S3Client::factory(array(
'key' => $store['s3']['key'],
'secret' => $store['s3']['secret']
));
}
foreach ($keyName as $key => $row) {
$varFileName = explode('/', $row);
$bucket = 'my-bucket-name';
$result = $this->s3Client->getObject(array(
'Bucket' => $bucket,
'Key' => $row
));
header("Content-Type: {$result['ContentType']}");
header("Content-Disposition: attachment; filename=\"{$varFileName[2]}\"");
header('Expires: 0');header("X-Sendfile: $varFileName[2]");
echo $result['Body'];
}
}