Recently I come across a very useful article, I bet every PHP developer must have tried this thing i.e. to upload a file and show upload progress often banging their head against wall to make their solution work across various browsers & platforms. Glad to see that PHP has addressed this problem in its latest release (PHP 5.4). A new directive is available in PHP 5.4, session.upload_progress.enabled, with setting this directive we will be able to track the upload progress of indivisual files being uploaded.
A problem that has plagued web developers for years is how to add real-time information to their applications, such as a progress bar for file uploads. Users are impatient; they don’t want to sit and wait while the browser is doing something and wonder whether it has frozen or if they have a slow connection. Providing a progress indicator gives users useful information and lets them know exactly what’s going on.
Remember for small size images this progress notification may not be noticible or that much useful, surely this is really useful if you are uploading infographic images or large documents or having slow internet connection, presenting user with upload progress rather than let user staring at the window and left him wondering when the file will get uploaded.
You can find more info about session.upload_progress.enabled ini directive and its usage on below link.
PHP: Session Upload Progress
When the session.upload_progress.enabled INI option is enabled, PHP will be able to track the upload progress of individual files being uploaded. This information isn’t particularly useful for the actual upload request itself, but during the file upload an application can send a POST request to a separate endpoint (via XHR for example) to check the status.
Not yet upgraded to 5.4? No problem, PECL has an extension for this, available for PHP 5.2 or higher version
PECL :: Package :: uploadprogress