Newscoop\NewscoopBundle\Controller\AttachmentsController::sendFileAsAttachment PHP Method

sendFileAsAttachment() private method

private sendFileAsAttachment ( $attachment, $attachmentService )
    private function sendFileAsAttachment($attachment, $attachmentService)
    {
        $file = $attachmentService->getStorageLocation($attachment);
        $fileSystemService = $this->get('newscoop.filesystem');
        $response = new BinaryFileResponse($file);
        $d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $attachment->getName(), $fileSystemService->sanitizeFileName($attachment->getName()));
        $response->headers->set('Content-Disposition', $d);
        return $response;
    }