PHP Function To Get A File Extension From A String

Getting the file extension from a PHP string can be very important in validating a file or file upload. I’ve written a simple PHP function to retrieve a file extension from a string.

function get_file_extension($file_name) {
	return substr(strrchr($file_name,'.'),1);
}

http://davidwalsh.name/php-file-extension – PHP Function To Get A File Extension From A String.

max

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>