Monitoring File Uploads using Ajax and PHP
Creating the File Upload Form
iframe in this HTML document.
This code loads the
prototype.js file, which is available for download from http://prototypejs.org. The version of Prototype used in this article 1.6.0. Additionally, the code loads
upload.js which we will create later in this article.
We load the
FileUploader.php in this file, allowing us to refer to the
ID_KEY constant (which corresponds to
APC_UPLOAD_PROGRESS). Obviously you could just hardcode this value – I've just done it this way to keep the code tidy with no "magic values".
This HTML document is completed by the inclusion of a div called
#status. This element is used to show the upload status data. At this stage it includes only placeholders for where the values will appear. We will use the
Template class that comes with Prototype to insert the values into the placeholders. By default, we hide this element.
hide()methods of Prototype we must hide the element using an inline
styletag, rather than using a CSS rule such as