Support the ongoing development of Laravel.io →
posted 10 years ago
Forms
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

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.

Last updated 2 years ago.
0

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

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.