diff --git a/app/Http/Controllers/HouseController.php b/app/Http/Controllers/HouseController.php index 8786c9f6..7f98e98b 100644 --- a/app/Http/Controllers/HouseController.php +++ b/app/Http/Controllers/HouseController.php @@ -42,14 +42,9 @@ public function update(Request $request, House $house) public function download(House $house) { // TASK: Return the $house->photo file from "storage/app/houses" folder - // for download in browser - $filePath = storage_path("app/houses/{$house->photo}"); - if(file_exists($filePath)) - { - return Storage::download($filePath); - } - else { - return response()->json(['error' => 'File not found'], 404); - } + $filePath = storage_path('app/houses/' . $house->photo); + + return response()->download($filePath); + //return Storage::download('houses/' . $house->photo); } } \ No newline at end of file