update image upload logic