>All Tutorials 
Ajax and .NET Ajax and .NET RSS XML
Ajax and ColdFusion Ajax and ColdFusion RSS XML
Ajax and Java Ajax and Java RSS XML
Ajax and PHP Ajax and PHP RSS XML
Ajax and SOA Ajax and SOA RSS XML
Ajax Goodies Ajax Goodies RSS XML
Ajax Tool Ajax Tool RSS XML
Facebook MockAjax Facebook MockAjax RSS XML
Google Web Toolkit Google Web Toolkit RSS XML
JavaScript Framework JavaScript Framework RSS XML
Ruby on Rails Ruby on Rails RSS XML
Technique Introduction Technique Introduction RSS XML
Without XMLHttpRequest Without XMLHttpRequest RSS XML
Yahoo! UI Yahoo! UI RSS XML

PHP AJAX File Upload Progress Meter Updates - upload php file joshua progress patch extension script

 
Registered tutorials: 501
Registered Users: 24390



Rating: 4.71 out of 7 votes cast


  
Category: Ajax and PHP

Tags Map

ajax apache apc april archive arora array august author background bar basic blog built call change check client code comment created current data days december demo demophp details dir directory download echo eichorn error errors extension february feedback file files filewidget finally find fine fixed form function good great greg handle handling height hidden hours htmlajax http iframe im include install installed javascript josh joshua js july june line link local making march mark matt meter michiel needed nice november object october output page pankaj patch patching path pear people perl personal php pm post problem progress progressbar read required rss run script september server set show simple site size solution source speed st start status step string stuff submit temp tested time title tore tracking undefined update updated updates upgrade upload uploaded uploading version versions website width windows work worked working works

Keyword Cloud Navigation Map

PHP AJAX File Upload Progress Meter Updates

Digg this   Post to del.icio.us

Abstract: The tutorials shows how to take a form containing a file upload and submit it using a hidden iframe as a target. Doing this lets the upload happen in the background. Then we poll the server on a regular basis asking it for update status.

Over the weekend my file upload progress meter code got lots of traffic. It seems it made it made it on the del.icio.us popular list as well as getting over a thousands diggs. To celebrate this i’ve updated the code.

The main new feature is giving you feedback without having to patch PHP. Now the patched version gives you more information such as upload speed and estimated time to completion. But we still provide some nice user feedback even without it now.

I also created some wiki pages to start the documentation process.

So here are the demo’s

With the patch and extension
Without the patch

To get upload speed you will need to download and install the PHP Upload Progress Patch and extension.

If you want to use the code you need to:
Install HTML_AJAX (pear install HTML_AJAX-alpha)
Download PAFUPMU and install it somewhere accessible.
Add the code to your page using demo.php as an example.

The basic way the code works is we take a form containing a file upload and submit it using a hidden iframe as a target. Doing this lets the upload happen in the background. Then we poll the server on a regular basis (say a 2 second interval) asking it for update status. If you have the patch+extension installed this gives you file upload speed etc. If you don’t have the extesion we stop making AJAX calls and just animate the status bar until the upload finishes in the iframe and tells us were done.

In demo.php we handle generating the current page and handling the upload in the same page. So we start by handling the update.

<?php

include 'UploadProgressMeter.class.php';

$fileWidget = new UploadProgressMeter();

if ($fileWidget->uploadComplete()) {
        // output javascript to the iframe to send a final status to the main window
        // this will catch error conditions
        echo $fileWidget->finalStatus();

        // move the file(s) where they need to go

        exit;
}

?>


Read Full Tutorial...



Reviews:

Rate and Review This Site

No reviews yet


Statistic Information About this Resource:


Total Hits: 1501
Unique Hits: 1304


  Daily Weekly Monthly
  Unique Total Unique Total Unique Total
Average 1.9 1.9 11.2 12.2 42.2 46.9
Current 2 2 12 12 52 55
Previous 1 1 11 11 62 69
Jul 22 5 5 18 20 0 0
Jul 21 4 4 13 14 113 124
Jul 20 1 1 22 24 56 58
Jul 19 1 1 0 0 22 29
Jul 18 0 0 14 16 0 0
Jul 17 3 3 10 12 37 42
Jul 16 2 2 12 13 40 43
Jul 15 0 0 0 0 40 49
Highest 20 26 94 112 359 439


Script Execution Time: 12.92261 | SQL Queries: 10 | Members: 501
Ajax Tutorial Top List - Powered by Aardvark Topsites PHP 5.1.2