sergionc
6 months ago
989
8
Laravel

insert image with eloquent

Posted 6 months ago by sergionc

save the route in temp.

public function store(Request $request)
{

    if($request->hasFile('avatar')){
        $file = $request->file('avatar');
        $name = time().$file->getClientOriginalName();
        $file->move(public_path().'/images/',$name);   
    }

    Foto::create($request->all());   
    return redirect('foto.index');    
    
}

Please sign in or create an account to participate in this conversation.