How to validate files,image and mime type in laravel

$validator = Validator::make($request->all(), [
‘Picture’ => ‘required|image|mimes:jpeg,bmp,png,gif,PNG,jpg’,

// Picture is name of file you set in form
// Its required
// Its must be image
// its must be jpeg,bmp,png,gif,PNG,jpg’
]);

if ($validator->fails()) {

return $validator->messages()->all(); // in aaray you will get all error regarding file

}

 

 

Add Comment

Required fields are marked *. Your email address will not be published.