Insert Image database
Hi, i'm already sorry for my english i'm french :) ;
Well, i'm novice with Laravel, and i'm training on a form, where i can put datas and image in my database for use them later.
Actually, I can upload my image in a folder in my project, and insert the image's name in the database, but I don't know how to insert the others data.
Here's my store function :
$file = $request->file('image');
$fileName = $file->getClientOriginalName();
$destinationPath = base_path() . '/public/images/';
$request->file('image')->move($destinationPath, $fileName);
Saisie::create([
'image' => $fileName
]);
When I write a Saisie::create($request->All()) after the first create, it register two lines in my database, the first with the image's name, and an another with my input's datas, and in the "image" collumn, a link like : C:\wamp\tmp\phpE64B.tmp
I could do like that :
$saisie = new Saisie;
$saisie->hauteur = $request->hauteur;
$saisie->image = $fileName
$saisie->save();
But with 15 inputs, I guess that there is an other way ^^
That's all, once again i'm sorry for my english, and i'll thank you if you have some ideas for help me !
Thank's
Please or to participate in this conversation.