added some validation for image upload