Skip to content

Commit

Permalink
fix: improved upload check
Browse files Browse the repository at this point in the history
  • Loading branch information
blt950 committed Aug 2, 2024
1 parent f734fc4 commit d2e0864
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/API/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/EventController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit d2e0864

Please sign in to comment.