Level 75
Make sure in your form you have:
enctype="multipart/form-data"
And review https://laravel.com/docs/6.x/filesystem#file-uploads
I want to store a file in database and save it in public but it save as .temp what should I do?
public function store(Request $request)
{
$this->validate($request , [
'title'=>'required' ,
'image'=>'required' ,
'video'=>'required'
]);
$new = [
'title'=>$request->input('title'),
'image'=>$request->file('image')->move(public_path('uploads')),
'video'=>$request->file('video')->move(public_path('uploads')),
];
File::create($new);
}
Please or to participate in this conversation.