<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
class StorageController extends Controller
{
public function gambar()
{
$path = request()->path;
if(str_contains($path,"..") || str_contains($path,"//") || str_contains($path,"\\") || str_contains(strtolower($path),"php") || str_contains(strtolower($path),".py")){
return abort(404);
}
if ($path != null && Storage::exists($path)) {
$fullPath = storage_path('app/' . $path);
$mime = File::mimeType($fullPath);
$headers = [
'Content-Type' => $mime,
];
return response()->file($fullPath, $headers);
} else {
return abort(404);
}
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]