i'm creating a multiUpload images system in my form, i want that users can upload 4 images in 4 different inputs and save their image, but i have this error:
NotReadableException in C:\xampp\htdocs\regalo\vendor\intervention\image\src\Intervention\Image\AbstractDecoder.php line 302: Image source not readable
MY FORM
{!! Form::open(array('url'=>'crea-regalo','method'=>'POST','class' => 'form-horizontal', 'files'=>true)) !!}
<!-- photo -->
<div class="form-group">
<label class="col-md-3 control-label" for="textarea"> Picture </label>
<div class="col-md-8">
<div class="mb10">
<input id="input-upload-img1" name="image[]" type="file" class="file" data-preview-file-type="text">
</div>
<div class="mb10">
<input id="input-upload-img2" name="image[]" type="file" class="file" data-preview-file-type="text">
</div>
<div class="mb10">
<input id="input-upload-img3" name="image[]" type="file" class="file" data-preview-file-type="text">
</div>
<div class="mb10">
<input id="input-upload-img4" name="image[]" type="file" class="file" data-preview-file-type="text">
</div>
{!! Form::close() !!}
MY CONTROLLER
foreach ($request->image as $imageArray){
// get file
$file = $request->file('image');
// create istance - Maybe here start the problem, doesn't get the files images
$image = image::make($imageArray);
// create path
$path = public_path().'/images/post/'.$get_post_created->id;
// rename file
$name_file = $get_post_created->id . '.' . $imageArray->getClientOriginalExtension();
// resize
$image->resize(100,100);
// save
$image->save($path.$name_file);
// store path reference
$store_path = new ImageUpload();
$store_path->path = 'images/post/'.$get_post_created->id.'/'.$name_file;
$store_path->post_id = $get_post_created->id;
$store_path->save();
}
I TRIED upload 2 images of 4 inputs:
public function creaPost(Request $request){
dd ($request->image);
....
...
}
I don't know if the input name="image[]" array are getting fine the files, or maybe i have some problem in foreach cycle in my controller. Thank you for your help!
