php-pathinfo

Using PHP pathinfo Function to Detect File Extention

Sometimes that’s not necessary to check a file’s mime type and you only need to check the file extension. To do that we can use PHP’s pathinfo() function. The function below is a an example of how to use pathinfo to parse out if a file is a PDF returning true if it is, false otherwise.