mirror of
https://github.com/filegator/filegator.git
synced 2025-08-02 00:30:31 +02:00
View PDF files in the browser (#51)
Co-authored-by: Paulo Sergio Klaus <code@pauloklaus.com.br>
This commit is contained in:
@@ -65,13 +65,21 @@ class DownloadController
|
|||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$contentDisposition = HeaderUtils::DISPOSITION_ATTACHMENT;
|
||||||
|
$contentType = 'application/octet-stream';
|
||||||
|
|
||||||
|
if (pathinfo($file['filename'], PATHINFO_EXTENSION) == 'pdf') {
|
||||||
|
$contentDisposition = HeaderUtils::DISPOSITION_INLINE;
|
||||||
|
$contentType = 'application/pdf';
|
||||||
|
}
|
||||||
|
|
||||||
$streamedResponse->headers->set(
|
$streamedResponse->headers->set(
|
||||||
'Content-Disposition',
|
'Content-Disposition',
|
||||||
HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, $file['filename'], 'file')
|
$contentDisposition
|
||||||
);
|
);
|
||||||
$streamedResponse->headers->set(
|
$streamedResponse->headers->set(
|
||||||
'Content-Type',
|
'Content-Type',
|
||||||
'application/octet-stream'
|
$contentType
|
||||||
);
|
);
|
||||||
$streamedResponse->headers->set(
|
$streamedResponse->headers->set(
|
||||||
'Content-Transfer-Encoding',
|
'Content-Transfer-Encoding',
|
||||||
|
Reference in New Issue
Block a user