public function gambarObjective(Request $request)
{
$exist = Storage::disk('emr_nas')->exists('3mcTLZuI0O.jpeg');
if ($exist) {
$mime = Storage::disk('emr_nas')->mimeType('3mcTLZuI0O.jpeg');
$get = Storage::disk('emr_nas')->get('3mcTLZuI0O.jpeg');
header("Content-type: $mime");
echo $get;
} else {
abort(404);
}
}
I have a controller that return a file like image or anything (not auto download but previewing it). It is work but i don't know am i doing it right? *please note it's not for upload, but previewing it only