PHP-gurus: I need your help!
PHP-gurus: I need your help!
Out of context: Reply #16
- Started
- Last post
- 22 Responses
- mike0
that works, but in the event that your file name has a dot in it other than the extension you will have a problem...
this works nicely to get the extension and ensures that it's the last .xxx in the name...
$sExt = array_pop(explode(".", $sFile));
explode breaks the string into array parts based on the delimiter and array_pop grabs the last item in the array index...
so if you file had a name like drunken.party.shot.jpg it would ensure that $sExt was assigned jpg