diff options
Diffstat (limited to 'routes/web.php')
| -rwxr-xr-x | routes/web.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/routes/web.php b/routes/web.php index 02fe4a7..048bc20 100755 --- a/routes/web.php +++ b/routes/web.php @@ -13,7 +13,15 @@ Route::get('/dq', [SiteController::class, 'duneQuote']); Route::post('/f', [SiteController::class, 'uploadFiles']); //TODO later use file resource or FPR service Route::get('/f/{path}', function($path){ - return response()->file(storage_path('/public/uploads/' . $path)); + $storpath = storage_path('app/public/uploads/' . $path); + if (!file_exists($storpath)){ + return response()->json(['error' => 'file not found ' . $storpath]); + } + $mime = Storage::mimeType($storpath); + return response()->file($storpath, [ + 'Content-Type' => $mime, + 'Content-Disposition' => 'inline; filename="'.$path.'"' + ]); }); Route::get('/4', [SiteController::class, 'search4chan']); |
