Split upload method into two for readability.