Laravel 5.8 - validation of multiple ex.video files

Asked

Viewed 169 times

0

I’m using Multiple to insert more than one file, but I’m not able to validate the size and format when one or more videos is inserted.

form:

<input type="file" name="anexo3[]" class="form-control @error('anexo3') is-invalid @enderror"  multiple >  

the validation I’m using:

public function rules()
    {
        return [

           'anexo3' =>  ['mimes:mp4,mov,ogg,qt','max:2000']

       ];
    }

1 answer

1

Using the Laravel validate.

   $request->validate([
        'anexo' => 'required',
        'anexo.*' => 'image|mimes:jpeg,png,jpg',
        'anexo.*' => 'max:2000'
    ]);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.