A couple of weeks ago I mentioned that PHP 5.2 would have support for tracking the progress of file uploads. However, when I went looking for signs of this new functionality I came away empty-handed and rather confused. It’s definitely there in the release notes, but I just couldn’t find any reference to it anywhere else.
So I posted a question to the PHP Internals mailing list, asking “where are the promised hooks for PHP upload progress monitoring?” and within a few hours I had a nice clear reply from none other than Rasmus Lerdorf himself:
They are C-level hooks. The various storage mechanisms need to add support for them in order to expose them to userspace PHP. I added support in pecl/apc, for example.
(pick some random file in the 200k size range)
Source at: http://progphp.com/progress.phps
Eventually we will see more extensions that manage server-side storage with support for the hooks.
…meaning that while in theory the functionality is there, it’s not exposed to ‘normal’ people — yet. There’s a proprietary but promising extension here, which might eventually make it into the PHP core (maybe). Until then (or until another similar patch gains acceptance) we’ll have to wait.
Oh and as a side-note, someone also posted a link to this extension that uses the upload hooks to allow you to scan files for viruses, during upload. Nice.