From d2e0864826f660c274f84220862754a1567433e3 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 2 Aug 2024 14:57:15 +0000 Subject: [PATCH] fix: improved upload check --- app/Http/Controllers/API/EventController.php | 2 +- app/Http/Controllers/EventController.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/API/EventController.php b/app/Http/Controllers/API/EventController.php index 6ea8738..8dba7f7 100644 --- a/app/Http/Controllers/API/EventController.php +++ b/app/Http/Controllers/API/EventController.php @@ -70,7 +70,7 @@ public function store(Request $request) $storedPath = $image->storeAs('banners', $imageName, 'public'); // Check if the image was successfully uploaded - if (!Storage::disk('public')->exists($storedPath)) { + if ($storedPath && !Storage::disk('public')->exists($storedPath)) { return back()->withErrors(['image' => 'Failed to upload the image.'])->withInput(); } diff --git a/app/Http/Controllers/EventController.php b/app/Http/Controllers/EventController.php index f6795fe..1058b78 100644 --- a/app/Http/Controllers/EventController.php +++ b/app/Http/Controllers/EventController.php @@ -78,7 +78,7 @@ public function store(Request $request) $storedPath = $image->storeAs('banners', $imageName, 'public'); // Check if the image was successfully uploaded - if (!Storage::disk('public')->exists($storedPath)) { + if ($storedPath && !Storage::disk('public')->exists($storedPath)) { return back()->withErrors(['image' => 'Failed to upload the image.'])->withInput(); }