mirror of
https://github.com/filegator/filegator.git
synced 2025-07-31 07:40:15 +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
|
||||
});
|
||||
|
||||
$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(
|
||||
'Content-Disposition',
|
||||
HeaderUtils::makeDisposition(HeaderUtils::DISPOSITION_ATTACHMENT, $file['filename'], 'file')
|
||||
$contentDisposition
|
||||
);
|
||||
$streamedResponse->headers->set(
|
||||
'Content-Type',
|
||||
'application/octet-stream'
|
||||
$contentType
|
||||
);
|
||||
$streamedResponse->headers->set(
|
||||
'Content-Transfer-Encoding',
|
||||
|
Reference in New Issue
Block a user