There are number of way to get file extension in php.

  1. <html>  
  2.  <body>  
  3. function getFileExtension($filename)
  4. {
  5. $fileinfo= pathinfo($filename);
  6. return $fileinfo[‘extension’];
  7. }
  8. $ext =end(explode(‘.’, $file));
  9. $ext = substr(strrchr($file,’.’), 1);
  10. $ext = substr($file, strrpos($file, ‘.’) +1);
  11. $ext = preg_replace(‘/^.*\.([^.]+)$/D’,’$1′, $file);
  12. $exts =split(“[/\\.]”, $file);
  13. $n = count($exts)-1;
  14. $ext = $exts[$n];
  15.  </body>   
  16. </html>  
eXTReMe Tracker