Cleaning code for image upload