From bb28501a05c144cc6d873029dcc5054c71f96fe0 Mon Sep 17 00:00:00 2001 From: Ilham Wara Nugroho Date: Tue, 2 Jun 2026 12:13:40 +0700 Subject: [PATCH] update --- app/Helpers/custom.php | 4 ++-- app/Http/Controllers/StorageController.php | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/Helpers/custom.php b/app/Helpers/custom.php index 4cb7000..3b66f69 100644 --- a/app/Helpers/custom.php +++ b/app/Helpers/custom.php @@ -1751,7 +1751,7 @@ if (!function_exists('formKriteria')) {
  Preview -   Download +   Download

'; @@ -1776,7 +1776,7 @@ if (!function_exists('formKriteria')) {
  Preview -   Download +   Download

'; diff --git a/app/Http/Controllers/StorageController.php b/app/Http/Controllers/StorageController.php index 8135558..e4ab917 100644 --- a/app/Http/Controllers/StorageController.php +++ b/app/Http/Controllers/StorageController.php @@ -30,6 +30,8 @@ class StorageController extends Controller } function fileasset(){ $path = request('path'); + $type = request('type'); + $content = 'inline'; try { // 🔍 cek dulu file ada atau tidak @@ -37,6 +39,12 @@ class StorageController extends Controller abort(404, 'File tidak ditemukan'); } + if (@$type == 'download'){ + $content = 'attachment'; + }else{ + $content = 'inline'; + } + $expl = explode('.',$path); if($expl[1] == 'pdf'){ @@ -63,7 +71,7 @@ class StorageController extends Controller } }, 200, [ 'Content-Type' => $mime, - 'Content-Disposition' => 'inline; filename="'.basename($path).'"', + 'Content-Disposition' => $content.'; filename="'.basename($path).'"', 'X-Content-Type-Options' => 'nosniff', ]);