check the format by looking at the extention of filename