validation and upload image