Skip to content

Instantly share code, notes, and snippets.

@devgiordane
Created April 10, 2021 20:10
Show Gist options
  • Save devgiordane/1b4292613fba5af9c3c1a66985e72507 to your computer and use it in GitHub Desktop.
Save devgiordane/1b4292613fba5af9c3c1a66985e72507 to your computer and use it in GitHub Desktop.
//image upload
if ($request->hasFile('image') && $request->file('image')->isValid()) {
$requestImage = $request->image;
$extension = $requestImage->extension();
$imageName = $requestImage->getClientOriginalName() . strtotime("now") . "." . $extension;
$request->file('image')->move(public_path('img/events', $imageName));
$event->image = $imageName;
}
$event->save();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment