Brady
A moan, a groan, my life story and how me, a technically minded person just can't seem to fit in with anybody.

Archive for February, 2008

PHP File Upload Progress Bar Part 2

After further investigation PHP 5.2.0 now allows you to use the APC (Alternative PHP Cache) addition with the ability to track the progress of uploads. Within windows it is as simply adding the dll extension to your php.ini and putting some configs there to. With Linux I’m not too sure how you add this extension as I don’t know Linux well. But anyway below is some nice and easy documentation on this.

PHP File Upload Progress Bar

PHP File Upload Progress Bar

As you may be aware in php it doesn’t have the functionality to report back the status of file uploads. For example upload percent complete, speed of upload and estimated time of completion. To be able to provide a progress bar the easiest way would be to use a perl script to do the uploading for you as perl has this functionality. Now I build a file uploader for the public and I looked at providing a perl uploader but because I know very little about the language of perl I couldn’t get any examples to work for me, but the ones that did work needed some server side changes. These server side changes would be no good for most of my downloader’s as many of them don’t have root access to their server.

There is another solution out there but once again it involves making server side changes which hacks php and adds the additional functions to track the upload progress of a file.

The above hack for PHP can be found at http://pecl.php.net/package/uploadprogress. There isn’t much documentation out there for it but if you do a Google search you will find one or two examples.

The above hack I’m thinking about putting it in my module so that those that have the modified php will be able to run my uploader with the progress bar but those without would not get the upload progress bar. The thing in to build my module to use this hack I need a server that is running the hacked version of php. Thing is I’m stuck with a shared hosting account and I don’t have access to modify php. So if there is anyone out there that can lend me some space for a short time and is running the above hack please contact me so I can’t continue building my file uploader script