Level 27
You are using a multiple file input photos[], so photos is an array. You have to validate your array.
'photos' => 'required|array',
'photos.*' => 'required|image'
2 likes
I have one problem with uploading image Validation. I uploaded valid format of image but the error said "Photo must be image."
THis is my validation.
'photos'=>'required| image',
This is my form.
<form method="post" action="{{route('new.product')}}" enctype="multipart/form-data">
@csrf
<div class="col-md-9">
<label for="photos" class="col-form-label input-label">Upload Photo</label>
<div class="custom-file">
<input type="file" class="form-control input-label shadow @if($errors->has('photos'))is-invalid @endif" id="photos" name="photos[]" multiple value="{{old('photos')}}">
@if($errors->has('photos'))<span class="invalid_feedback text-danger" style="font-size: 10px;">{{$errors->first('photos')}}</span> @endif
</div>
</div>
</form>
Please help me to figure out this problem. Thank you in advance.
Please or to participate in this conversation.