finish function for uploading image