Write Upload() function to simplify