Originally posted August 23, 2006
———————————————–
Update: 4/8/07, added a 5.2.1 patch to the php5 tar ball
———————————————–
Ever wanted to display the progress of an upload to your user? This is handy for large uploads, gives users of your web site an idea of how long is left on the upload.
Unfortunately, PHP doesn’t provide this ability natively. Your first line of code in your PHP program receiving the upload doesn’t run until after the upload is complete. Therefore, there is no way, natively, for you to know the progress of the upload during the upload. Fortunately, I have a real solution. I downloaded a PHP source code patch (original patch available here http://pdoru.from.ro/) that adds this ability to PHP, then modified it to log data to a MySQL table or a flat file. The original patch did flat file only, which doesn’t work well on load balanced systems that need to share a data repository.