As I haven't found any good exemple written for APC, I have adapted the one provided by the uploadprogress extension.

Configuration :

In the /etc/php.d/apc.ini file, enable this feature :

; RFC1867 File Upload Progress hook handler
apc.rfc1867=1
apc.rfc1867_prefix =upload_
apc.rfc1867_name=APC_UPLOAD_PROGRESS
apc.rfc1867_freq=1m
apc.rfc1867_ttl=3600

Download the apcupload.tgz archive.

Which contains 3 files:

  • index.php : the main script, with the form and the Ajax part which will request the server for information about the current upload
  • info.php : the script which provide the information about an upload
  • server.php : the script which process the uploaded file

Of course, this is only a "proof of concept" (and, for me, a regression test for the APC extension I'm used to run on each new RPM version).

Next : implement this, cleanly, in a real application (at random: GLPI ?).