Roman Miranda Roman Miranda - 1 year ago 118
PHP Question

Laravel 5.3 Upload an image with Auth user::create

I am trying to add an image to the user. To create the user I use
system make:Auth but I don't know how can I get the file name because on

create(array $data)
I don't receive the file name.

protected function create(array $data)
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => bcrypt($data['password']),
'img' =>

I can't put
'img' = $data['img']
because I need the file name.

How can i get the file name?

Answer Source

use the getClientOriginalName method because it's symfony UploadedFile instance try this :


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download