I'm trying to store images to the database using this plugin demo, but I get an error Call to a member function store() on array. Can any one help me fix this so I can be able to store images to the database?
I use javascript when submitting the form and on console(request) it shows like category_name: Women fileuploader-list-files: [{"file":"0:/innostudio.de_twitter.png"}] files[]: (binary) files[]: (binary) _token: LZWSXmAbVuIL5HXullJWmJWbJ3wSRU9c9dEtV1cF
Controller
foreach ($request->files as $photo) {
$filename = $photo->store('public/photos');
ProductsPhoto::create([
'product_id' => $product->id,
'filename' => $filename
]);
}
Blade
<input type="file" name="files">
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire