ReakyMark
1 year ago

Validator array data error htmlspecialchars() expects parameter 1 to be string

Posted 1 year ago by ReakyMark

this is my HTML form

<tr>
    <td>
        <input type="text" name="title[]" value="" class="form-control" placeholder="Enter Title">
    </td>
    <td>
        <input type="file" class="btn-default btn" name="gallary[]" id="galary1"/>
    </td>
    <td>
        <i class="btn btn-danger fa fa-times-circle remove-gallary" aria-hidden="true"></i>
    </td>
</tr>

this is my Validator code

Validator::make(
    $req->all(),
    [
        'title.*' => 'required',
        'gallary.*' => 'required|image|mimes:jpeg,png,jpg,gif|max:2048',
    ]
)->validate();

if i remove validator code it upload my image and create in DB but if i set Validate like above code i got error with htmlspecialchars() expects parameter 1 to be string.

how to solve it ?

Please sign in or create an account to participate in this conversation.