Skip to content

Commit

Permalink
Update inline content disposition for file
Browse files Browse the repository at this point in the history
  • Loading branch information
na-ji committed Mar 12, 2017
1 parent a727282 commit 3df68ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/nk/DocumentBundle/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public function uploadAction(Document $document)

public function downloadAction(File $file)
{
$contentDisposition = 'attachment; filename="'.$file->getName().'"';
$method = 'attachment';
if ($this->request->get('inline', false)) {
$contentDisposition = 'inline';
$method = 'inline';
}

$response = new Response();
$response->headers->set('Content-Type', "application/pdf");
$response->headers->set('Content-Disposition', $contentDisposition);
$response->headers->set('Content-Disposition', $method.'; filename="'.$file->getName().'"');
$response->headers->set('Content-Transfer-Encoding', 'binary');
$response->headers->set('Content-Length', filesize($file->getPath()));
$response->setStatusCode(200);
Expand Down

0 comments on commit 3df68ad

Please sign in to comment.