I'm trying to store multiple images to the database but it only stores one image. I don't see any errors. I have tried this but it stores images in public folder, I want the images to be stored in database. How can I fix this? any help would be appreciated.
Controller
if($request->hasFile('files')){
$files = $request->file('files');
foreach ($files as $file) {
$filename = $file->getClientOriginalName();
$images = $file->store('public/photos');
}
}
ProductsPhoto::create([
'product_id' => $product->id,
'filename' => $images
]);
Blade
<input type="file" name="files[]">
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2LOSwhY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire