mirror of
https://github.com/filegator/filegator.git
synced 2025-08-06 12:36:39 +02:00
download_inline configuration #141
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## Upcoming...
|
## Upcoming...
|
||||||
|
|
||||||
|
* New config: 'download_inline' #141 (download configured extensions inline in the browser)
|
||||||
* Korean language added #119 (Thanks Jinhee-Kim)
|
* Korean language added #119 (Thanks Jinhee-Kim)
|
||||||
* Galician language added #126 (Thanks vinpoloaire)
|
* Galician language added #126 (Thanks vinpoloaire)
|
||||||
* Russian language added #128 (Thanks BagriyDmitriy)
|
* Russian language added #128 (Thanks BagriyDmitriy)
|
||||||
|
@@ -66,12 +66,14 @@ class DownloadController
|
|||||||
// @codeCoverageIgnoreEnd
|
// @codeCoverageIgnoreEnd
|
||||||
});
|
});
|
||||||
|
|
||||||
$mimes = (new MimeTypes())->getMimeTypes(pathinfo($file['filename'], PATHINFO_EXTENSION));
|
$extension = pathinfo($file['filename'], PATHINFO_EXTENSION);
|
||||||
|
$mimes = (new MimeTypes())->getMimeTypes($extension);
|
||||||
$contentType = !empty($mimes) ? $mimes[0] : 'application/octet-stream';
|
$contentType = !empty($mimes) ? $mimes[0] : 'application/octet-stream';
|
||||||
|
|
||||||
$disposition = HeaderUtils::DISPOSITION_ATTACHMENT;
|
$disposition = HeaderUtils::DISPOSITION_ATTACHMENT;
|
||||||
|
|
||||||
if ($contentType == 'application/pdf') {
|
$download_inline = (array)$this->config->get('download_inline', ['pdf']);
|
||||||
|
if (in_array($extension, $download_inline) || in_array('*', $download_inline)) {
|
||||||
$disposition = HeaderUtils::DISPOSITION_INLINE;
|
$disposition = HeaderUtils::DISPOSITION_INLINE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ return [
|
|||||||
'public_dir' => APP_PUBLIC_DIR,
|
'public_dir' => APP_PUBLIC_DIR,
|
||||||
'overwrite_on_upload' => false,
|
'overwrite_on_upload' => false,
|
||||||
'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php
|
'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php
|
||||||
|
'download_inline' => ['pdf'], // download inline in the browser, array of extensions, use * for all
|
||||||
|
|
||||||
'frontend_config' => [
|
'frontend_config' => [
|
||||||
'app_name' => 'FileGator',
|
'app_name' => 'FileGator',
|
||||||
|
@@ -5,6 +5,7 @@ return [
|
|||||||
'public_dir' => __DIR__.'/../../dist',
|
'public_dir' => __DIR__.'/../../dist',
|
||||||
'overwrite_on_upload' => false,
|
'overwrite_on_upload' => false,
|
||||||
'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php
|
'timezone' => 'UTC', // https://www.php.net/manual/en/timezones.php
|
||||||
|
'download_inline' => ['pdf'],
|
||||||
|
|
||||||
'frontend_config' => [
|
'frontend_config' => [
|
||||||
'app_name' => 'FileGator',
|
'app_name' => 'FileGator',
|
||||||
|
Reference in New Issue
Block a user