public function isFileTypeSupported($fileType) { // it's also possible to pass a path or filename if (preg_match("/\\.?(pdf|doc|docx|odt|xls|xlsx|ods|ppt|pptx|odp)\$/", $fileType)) { return true; } return false; }