$filename = $_FILES['file']['name'];
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); //Walidacja Rozszerzenia
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_file($finfo, $_FILES['file']['tmp_name']); //Walidacja Mine
finfo_close($finfo);
if (!in_array($mime, ['application/pdf']) OR !in_array($extension, ['pdf'])) {
return Response::renderJSON(['code' => 403, 'message' => 'Allowed only: \'pdf\''])
->status(403)
->display();
}
$FileStorage->isAllowedFileType($filename, ['pdf'])