complete the media upload function