upload and capture code