HostOnNet Blog

PHP function to find file extension

Looking for Linux Server Admin or WordPress Expert? We can help.

To find file extension with PHP, use pathinfo function


$video = 'hostonnet.avi';
$info = pathinfo($video);
echo '<pre>';

// File extension

echo $info['extension'] . "<br>"; // avi

// File Name with out extension

echo $info['filename'] . "<br>"; // hostonnet

Posted in PHP

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.