How can the file extension of an uploaded file be extracted from the $_FILES[] superglobal in PHP?

To extract the file extension of an uploaded file from the $_FILES[] superglobal in PHP, you can use the pathinfo() function to get the extension. This function returns an associative array containing information about the file path. You can then access the 'extension' key to get the file extension.

$fileExtension = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
echo "File extension: " . $fileExtension;