I got error while uploading multiple image in laravel.
HTML Code :-
<div class="form-group">
<label for="title">Art Gallery</label>
<input type="file" name="art_image[]" id="art_image" value="" accept="image/*" multiple="multiple">
</div>
:- Controller code
if ($request->hasFile('art_image')) {
$fileImage1 = $request->file('art_image');
$StoreName = array();
foreach ($fileImage1 as $files) {
$filename1 = time().rand(1,100).".".$files>getClientOriginalExtension();
$StoreName[] = $filename1;
if($files->move(ART_IMAGE_DIR_PATH, $filename))
{
$data['art_image'] = $filename1;
}
}
$artdetail_model->art_image = serialize($StoreName);
}
I got below error
preg_replace(): Parameter mismatch, pattern is a string while replacement is an array
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire