Internet speed test server


I need to write simple script to test internet performance(download,
upload) speed. Best way is to check upload and download time of some files
from server. But is there any chance to meassure upload time of file and
then meassure of download time file ? What functions should I use ?

Pawel Rutkowski