What's the best way/practice to get the extension of a uploaded file in PHP
<p>I have a form that allow users to upload files, I however need to get the file extension, which I am able to get, but not sure if I'm using the most effective solution</p>

<p>I can get it using the following ways</p>

<pre><code>$fileInfo = pathinfo($_FILES['File']['name']);
echo $fileInfo['extension'];

$ext = end(explode('.',$_FILES['File']['name']));
echo $ext;
</code></pre>

<p>Which method is the best to use or are there even better solutions that would get the extension?</p>
