What do you mean by save an image name? Do you want it so save as a file? Or into the database? What are you trying to achieve?
Hi, i have a file upload in a form. I want to save the filename in the database.
$this->player->email = Input::get('email'); $this->player->image = $file->getClientOriginalName(); $this->player->save();
This code works well for me. But i'm search a shorter solution. I don't want to list all database fields. I try it with $this->player->create(); It's works too, except the image name.
I'm not sure if there is a shorter way. Well you could do something like this
$this->player->create(['email'=>Input::get('email'), 'image'=>getClientOriginalName()]);
but I'm not sure if it's a better way
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community