lundi 17 juin 2019

Update an image in laravel

I want to update user image but it's not getting updated.

i tried with $request->hasFile('image') but when i return these statement it alwayes return fale

here is my controller

if($request->hasFile('image'))
{
$file = $request->file('image');
$file->move(public_path().'/image/',$file->getClientOriginalName());
$file_name = $file->getClientOriginalName();
DB::table('settings')
->where('id', $id)
->update(['logo' => $file_name]);
}

when i write

return response()->json($request->hasFile('image'));

it will be return always false



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire