Login Latest Snippets Home My Account
Snippee! A personal code snippet manager... Store, share, organize! ...

Get file extension

Published: 2011-08-11 18:38:18 - In: PHP

Returns the file extension of a file

function getFileExtension($file){
	$path_parts = pathinfo($file);
	return $path_parts['extension'];
}

if (getFileExtension($file) == 'jpg'{
	//File extension is .jpg
}