To find file extension with PHP, use pathinfo function
<?php $video = 'hostonnet.avi'; $info = pathinfo($video); echo '<pre>'; print_r($info); // File extension echo $info['extension'] . "<br>"; // avi // File Name with out extension echo $info['filename'] . "<br>"; // hostonnet