Added validity for jpg and png