added check for file type, and check if image url exists already