Skip to content

Commit

Permalink
v4
Browse files Browse the repository at this point in the history
  • Loading branch information
maged-web committed May 4, 2024
1 parent f8768a2 commit 82b2cc0
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions app/Http/Controllers/HouseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

0 comments on commit 82b2cc0

Please sign in to comment.