Detailed cos upload example, with source code