Find the extension of filename in php
by rajesh[ Edit ] 2010-01-03 15:54:52
we can use the function pathinfo to find or get the extension of the filename.
// First use the function pathinfo. send the filename as argument to pathinfo.
$info = pathinfo($file);
// the resulting array has the extension. we can fetch it as shown below.
$file_name = $info['extension'];