update image upload function