I am using Form request validation to validating font extension. I'm uploading font types, and my rules are so:
public function rules()
{
if($this->method() == 'POST') {
return [
'fonteot' => 'file|mimetypes:eot,application/vnd.ms-fontobject',
'fontttf' => 'file|mimetypes:ttf,application/x-font-ttf,font/ttf,application/x-font-truetype',
'fontwoff' => 'file|mimetypes:woff,application/font-woff,application/x-font-woff,font/woff',
'fontwoff2' => 'file|mimetypes:woff2,font/woff2',
];
}
return [
'fonteot' => 'file|mimetypes:eot,application/vnd.ms-fontobject',
'fontttf' => 'file|mimetypes:ttf,application/x-font-ttf,font/ttf,application/x-font-truetype',
'fontwoff' => 'file|mimetypes:woff,application/font-woff,application/x-font-woff,font/woff',
'fontwoff2' => 'file|mimetypes:woff2,font/woff2',
];
}
According to the documentation, I am using mime types for the files extension but my validator can't pass woff & woff2 and redirect to my form and return error messages:
The fontwoff must be a file of type: woff, application/font-woff, application/x-font-woff, font/woff
The fontwoff2 must be a file of type: woff2, font/woff2
What is the cause of this?