title: How to download LARGE files using AWS getObject and Range?
body: <p>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?</p>
  
  <pre><code>function DownloadContent($keyName) {
      $store = array();
      require(__DIR__ . '/../config/s3Config.php');
  
      if (!$this-&gt;s3Client) {
          $this-&gt;s3Client = S3Client::factory(array(
                      'key' =&gt; $store['s3']['key'],
                      'secret' =&gt; $store['s3']['secret']
          ));
      }
  
      foreach ($keyName as $key =&gt; $row) {
          $varFileName = explode('/', $row);
          $bucket = 'my-bucket-name';
          $result = $this-&gt;s3Client-&gt;getObject(array(
              'Bucket' =&gt; $bucket,
              'Key' =&gt; $row
          ));
  
          header("Content-Type: {$result['ContentType']}");
          header("Content-Disposition: attachment; filename=\"{$varFileName[2]}\"");
          header('Expires: 0');header("X-Sendfile: $varFileName[2]");
          echo $result['Body'];
      }
  }
  </code></pre>