/*
- Get File Extension
- Gets the file extension from the file's name.
$fileName - The name of the file to get the extension of.
$includePeriod - Whether or not to include the prefix period (eg. ".txt")
*/
public function getFileExtension($fileName, $includePeriod = true) {
if (strpos($fileName, ".")) {
$sides = explode(".", $fileName);
$ext = "";
if ($includePeriod)
$ext .= ".";
$ext .= $sides[count($sides) - 1];
return $ext;
} else
return "N/A";
}
Comments