Shouldn't this be? ```substr($filename, strrchr($filename, '.'));```
It looks like you're missing the first arg for substr