Laravel - Request and Response
You want to upload multiple images and save their paths in the database. Which Laravel approach correctly handles multiple file uploads in a request named
photos?photos?foreach ($request->file('photos') as $photo) {
$path = $photo->store('gallery');
Photo::create(['path' => $path]);
} loops over each file, stores it, and saves path correctly. Others treat files as single or misuse methods.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions