0

I am applying laravel validation for multiple image it works for single iamge upload but can not works for multiple what is mistake done by me?

$this->validate($request, array(
     'imagenew.*' => 'required|mimetypes:image/jpeg,image/png,image/jpg',
     'image'=>'required|mimes:jpeg,png,jpg',
        
));

Blade :

<div class="col-sm-4">
    <label for="image" class=" form-control-label">Property Single Image</label>
    <input type="file" id="image" name="image" class="form-control-file">
   <span class="text-danger" required>{{ $errors->first('image') }}</span>
    
</div>
<div class="col-sm-4">
    <label for="imagenew" class=" form-control-label">Property Multiple Image</label>
    <input type="file" id="imagenew" name="imagenew[]" class="form-control-file" multiple>
  <span class="text-danger" required>{{ $errors->first('imagenew') }}</span>
</div>

1 Answer 1

1

Try this :

$validated = $request->validate([
   'imagenew' => 'required|array',
   'imagenew.*' => 'required|mimes:jpeg,png,jpg',
   'image'=>'required|mimes:jpeg,png,jpg',
]);
Sign up to request clarification or add additional context in comments.

1 Comment

@VikramShinde what is the output of dd($request->all()); ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.