See http://svn.php.net/viewvc/pecl/uploadprogress/trunk/examples/ for a little example.
It is only known to work on Apache with mod_php, other SAPI implementations unfortunately still have issues.
At least PHP 5.2 is needed.