update
parent
4c27b517c5
commit
bb28501a05
|
|
@ -1751,7 +1751,7 @@ if (!function_exists('formKriteria')) {
|
||||||
<label class="fw-500">Dokumen '.$data->judul.'</label>
|
<label class="fw-500">Dokumen '.$data->judul.'</label>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
<a class="text-white btn btn-sm bg-primary" data-title="'.$data->judul.'" data-target="#modal" data-type="'.$extension[1].'" data-fancybox href="' . url('fileasset?path=/' . $checkFile->value) . '"href="#"><i class="fal fa-eye"></i> Preview</a>
|
<a class="text-white btn btn-sm bg-primary" data-title="'.$data->judul.'" data-target="#modal" data-type="'.$extension[1].'" data-fancybox href="' . url('fileasset?path=/' . $checkFile->value) . '"href="#"><i class="fal fa-eye"></i> Preview</a>
|
||||||
<a class="text-white btn btn-sm bg-success" download data-title="'.$data->judul.'" data-type="'.$extension[1].'" href="' . url('fileasset?path=/' . $checkFile->value) . '"href="#"><i class="fal fa-download"></i> Download</a>
|
<a class="text-white btn btn-sm bg-success" data-title="'.$data->judul.'" data-type="'.$extension[1].'" href="' . url('fileasset?path=/' . $checkFile->value.'&&type=download') . '"href="#"><i class="fal fa-download"></i> Download</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>';
|
<hr>';
|
||||||
|
|
@ -1776,7 +1776,7 @@ if (!function_exists('formKriteria')) {
|
||||||
<label class="fw-500">Dokumen '.$dataOption.'</label>
|
<label class="fw-500">Dokumen '.$dataOption.'</label>
|
||||||
<div class="d-flex gap-2">
|
<div class="d-flex gap-2">
|
||||||
<a class="text-white btn btn-sm bg-primary" data-fancybox href="' . url('fileasset?path=/' . $checkFile->value) . '" href="#"><i class="fal fa-eye"></i> Preview</a>
|
<a class="text-white btn btn-sm bg-primary" data-fancybox href="' . url('fileasset?path=/' . $checkFile->value) . '" href="#"><i class="fal fa-eye"></i> Preview</a>
|
||||||
<a class="text-white btn btn-sm bg-success" download href="' . url('fileasset?path=/' . $checkFile->value) . '" href="#"><i class="fal fa-download"></i> Download</a>
|
<a class="text-white btn btn-sm bg-success" href="' . url('fileasset?path=/' . $checkFile->value.'&&type=download') . '" href="#"><i class="fal fa-download"></i> Download</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<hr>';
|
<hr>';
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,8 @@ class StorageController extends Controller
|
||||||
}
|
}
|
||||||
function fileasset(){
|
function fileasset(){
|
||||||
$path = request('path');
|
$path = request('path');
|
||||||
|
$type = request('type');
|
||||||
|
$content = 'inline';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 🔍 cek dulu file ada atau tidak
|
// 🔍 cek dulu file ada atau tidak
|
||||||
|
|
@ -37,6 +39,12 @@ class StorageController extends Controller
|
||||||
abort(404, 'File tidak ditemukan');
|
abort(404, 'File tidak ditemukan');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (@$type == 'download'){
|
||||||
|
$content = 'attachment';
|
||||||
|
}else{
|
||||||
|
$content = 'inline';
|
||||||
|
}
|
||||||
|
|
||||||
$expl = explode('.',$path);
|
$expl = explode('.',$path);
|
||||||
|
|
||||||
if($expl[1] == 'pdf'){
|
if($expl[1] == 'pdf'){
|
||||||
|
|
@ -63,7 +71,7 @@ class StorageController extends Controller
|
||||||
}
|
}
|
||||||
}, 200, [
|
}, 200, [
|
||||||
'Content-Type' => $mime,
|
'Content-Type' => $mime,
|
||||||
'Content-Disposition' => 'inline; filename="'.basename($path).'"',
|
'Content-Disposition' => $content.'; filename="'.basename($path).'"',
|
||||||
'X-Content-Type-Options' => 'nosniff',
|
'X-Content-Type-Options' => 'nosniff',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue