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