Sunday, May 21, 2017

Why did the photo I uploaded did not work?

I will upload photos, this is my controller and is there any error in writing my source code?

public function update_foto(Request $request)
{
  if ($request->hasFile('foto')) {
    $foto = $request->file('foto');
    $filename = time() . '.' . $foto->getClientOriginalExtension();
    Image::make($foto)->resize(300, 300)->save( public_path('/fotoupload/profile/' . $filename) );

    $user = Auth::user();
    $user->foto = $filename;
    $user->save();
  }
  return view('profile.index', ['user' => Auth::user()]);
}



via Agus Suparman

Advertisement