protected function checkIfFileIsWhitelisted($url)
    {
        $ret = false;

        // check for valid url
        if (empty($url)) {
            return false;
        }

        // parse url to extract only path
        $urlParts = parse_url($url);
        $filePath = $urlParts['path'];

        // Extract last file extension
        if (preg_match('/\.([^\.]+)$/', $filePath, $matches)) {
            $fileExt = trim(strtolower($matches[1]));

            // Check if file extension is whitelisted
            foreach ($this->fileExtList as $allowedFileExt) {
                if ($allowedFileExt === $fileExt) {
                    // File is whitelisted, not blacklisted
                    $ret = true;
                    break;
                }
            }
        }

        return $ret;
    }