My very limited experience in this space is that measuring uploads is actually quite a bit trickier and harder to nail down than download speeds
Perhaps you can audit the https://github.com/openspeedtest/Speed-Test codebase
Perhaps you can audit the https://github.com/openspeedtest/Speed-Test codebase