dimanche 13 octobre 2019

Error when uploading image on database "Call to a member function getClientOriginalName() on string"

i have problem when upload image on database. the error is "Call to a member function getClientOriginalName() on string". Please help me to solve my error. TQ

public function store(Request $request)
    {
        if ($request->file) {

            $filename = uniqid() . '_' . $request->file->getClientOriginalName();

            $request->file->move(public_path('img/staf'), $filename); //upload picture on database

            $data->store($request->all() + ['gambar' => $filename]);

        } else {
            $data = Pekerja::create($request->all());
        }

        return redirect()->to($request->prev_url)
                         ->with('Success','Pekerja Berjaya Ditambah!');
    }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2IOAURS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire