This is fairly difficult. Given that you know a file's size, you still need to know a rate of transfer. I'm not sure, but I don't think that PHP really has much to do with the actual streaming/serving of said data, and therefore rates can't be estimated accurately.
Even if you know that the client is connected at a certain speed (and you usually don't ... you could ask, I suppose ... many multimedia sites do), at best you'd have some mathematical formula based on file size divided by rate of transfer --- this is generally where the "estimates" you see on the web are coming from. If you wish to program your own, most of the data you need is probably here. Have the client enter the speed of their connection, and use this number to divide the filesize and get your timing ... in a picture perfect world (e.g., if you were on a two-machine Internet).
Now, if you could somehow access the raw data stream, then you can give a better indicator of progress. This is what the people who developed "Mega Upload" did, but using PERL to access the raw data ....
Given that PHP is in continual development and does, generally speaking, give plenty of access to low-level functionality, I'd be happy if my post could be refuted. But, at present, I dunno if it can be....