Use pathinfo to get the extension