code:
var dotarray = string.split'
extension = dotarray[dotarray.length-1];
Should get everything after the final dot, which should be the extension. Don't know if you can pick up the path for the file being sent, never tried. But if you do, that'll get the extension from the path...