Symfony\Component\HttpFoundation\BinaryFileResponse::sendContent PHP Method

sendContent() public method

public sendContent ( )
    public function sendContent()
    {
        if (!$this->isSuccessful()) {
            return parent::sendContent();
        }
        if (0 === $this->maxlen) {
            return $this;
        }
        $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());
        }
        return $this;
    }

Usage Example

 /**
  * Sends the file using the encryption manager with the php://output internal stream
  */
 public function sendContent()
 {
     if (!$this->isSuccessful()) {
         parent::sendContent();
         return;
     }
     $this->encryptionManager->decryptFile($this->file->getPathname(), 'php://output', $this->fileSize);
 }
All Usage Examples Of Symfony\Component\HttpFoundation\BinaryFileResponse::sendContent