I am able to upload all other field values but not images.
My View:
Hobby 1
<input name="hobby[]" placeholder="Hobby1" type="text">
<input type="file" name="hobby_img[]">
<button>Add New Hobby</button>
Controller
public function store(Request $request, Hobby $hobbies)
for ($i=0; $i < count(request('hobby')); ++$i)
{
$hobbies = new Hobby;
$hobbies->hobby = request('hobby')[$i];
$images = $request->file('hobby_img');
$hob_img = uniqid() . '.' .$images[$key]->getClientOriginalExtension();
$images[$i]->move(public_path('/assets/images/'), $hob_img);
$hobbies->hobby_img = $hobby_img[$i];
$hobbies->save();
}
But it says
The file xxxx.jpg" was not uploaded due to an unknown error.