Tips on adding PECL uploadprogress to your PHP scripts

Written by jeremy on November 4, 2010

I’ve been working on adding PECL Uploadprogress support to the drupal viddler module to give the user a better indication of how long the upload process will take. In this process I ran into a few gotchas that I thought I would pass along.

  • Make sure to have the UPLOAD_IDENTIFIER hidden element before your file input element. Otherwise it won’t be able to find your uploaded file to monitor.
  • Use the example code provided to make sure your uploadprogress extension in php is actually working. Since moving to Snow Leopard which is an 64bit OS the module would load, but not work properly. I had to download the latest version for php and put it in the php extensions folder.
  • If you do anything else after the upload that holds up the form from posting (ie http post to another server) expect the timing for the upload progress to only show the upload to the server’s local disk not the remote call.

I’m sure there were other things I ran into, but these were the major ones. Good luck and happy coding!

Buffer