PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Monitoring File Uploads using Ajax and PHP

Instantiating the FileUploader JavaScript Class

The final step in making this code work is to actually instantiate the FileUploader JavaScript class. To do this we implement the upload.js file that was loaded in index.php.

All this code does is wait until the page has finished loading then instantiates the class with the appropriate parameters (the ID values for the form and the status container).

Listing 18 Instantiating the FileUploader JavaScript class once the page has loaded (upload.js)
Event.observe(window, 'load', function() {
    new FileUploader('theForm', 'status');
});

In This Article


Additional Files