public function BinaryFileResponse::setContentDisposition

Sets the Content-Disposition header with the given filename.

Parameters

string $disposition ResponseHeaderBag::DISPOSITION_INLINE or ResponseHeaderBag::DISPOSITION_ATTACHMENT:

string $filename Optionally use this filename instead of the real name of the file:

string $filenameFallback A fallback filename, containing only ASCII characters. Defaults to an automatically encoded filename:

Return value

BinaryFileResponse

1 call to BinaryFileResponse::setContentDisposition()
BinaryFileResponse::setFile in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php
Sets the file to stream.

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/BinaryFileResponse.php, line 140

Class

BinaryFileResponse
BinaryFileResponse represents an HTTP response delivering a file.

Namespace

Symfony\Component\HttpFoundation

Code

public function setContentDisposition($disposition, $filename = '', $filenameFallback = '') {
  if ($filename === '') {
    $filename = $this->file
      ->getFilename();
  }
  $dispositionHeader = $this->headers
    ->makeDisposition($disposition, $filename, $filenameFallback);
  $this->headers
    ->set('Content-Disposition', $dispositionHeader);
  return $this;
}