You are here

public function BinaryFileResponse::sendContent in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-foundation/BinaryFileResponse.php \Symfony\Component\HttpFoundation\BinaryFileResponse::sendContent()

Sends the file.

Overrides Response::sendContent

File

vendor/symfony/http-foundation/BinaryFileResponse.php, line 253

Class

BinaryFileResponse
BinaryFileResponse represents an HTTP response delivering a file.

Namespace

Symfony\Component\HttpFoundation

Code

public function sendContent() {
  if (!$this
    ->isSuccessful()) {
    parent::sendContent();
    return;
  }
  if (0 === $this->maxlen) {
    return;
  }
  $out = fopen('php://output', 'wb');
  $file = fopen($this->file
    ->getPathname(), 'rb');
  stream_copy_to_stream($file, $out, $this->maxlen, $this->offset);
  fclose($out);
  fclose($file);
  if ($this->deleteFileAfterSend) {
    unlink($this->file
      ->getPathname());
  }
}