title: Not able to get image file extension
body: <p>I'm using Uploadify to upload an image to the server.<br>
  The image is uploaded, and placed in the temp folder of the web server.</p>
  
  <p>Now I need to work with the file beore moving it to it's real location, and I have the following code:</p>
  
  <pre><code>// Get the filepath and filename from server temp dir
  $sourceFile   = $_FILES[ 'Filedata' ][ 'tmp_name' ]; // e.g. c:\server\path\tmp\php159.tmp
  
  // Solution 1 for getting file extension
  $fileExt1     = pathinfo($sourceFile, PATHINFO_EXTENSION); // &lt;-- This only returns .tmp
  
  // Solution 2 with getimagesize
  list(,,$extension) = getimagesize($sourceFile);
  $fileExt2     = $extension; // this only returns the number 2.
  
  // Solution 3 with getimagesize
  $img = getimagesize($sourceFile);
  $fileExt3 = $img[2]; // this only returns the number 2.
  </code></pre>
  
  <p>I'm not using regex to read filename, because a user may name the file anything, so I have to read file data.</p>
  
  <p>Any sugegstions anyone?</p>