Update(2009-09-19): JSON encoding and decoding is built into PHP since PHP 5.20. You don't need Zend's JSON support if your PHP version is >= 5.20. Please see:
So you are writing a piece of PHP code to handle some Ajax request and you've just finished coding the business logic. It is time to output some server response so that the page which initiated the Ajax request can obtain the requested result.
You decided to use JSON because you don't want to get your hands dirty by traversing nodes after nodes. After encoding a fairly complex and nested PHP array into JSON, you find out writing such code is very unpleasant and you start wondering if there is an easier way to do this. The answer is yes - Zend Framework will save your day.
The theory that makes asynchronous file upload work is not complicate, but the code for it to work can be a little bit lengthy if it was developed from the scratch. Since there no reason to reinvent the wheel and YUI's Connection Manager can take care of most of the dirty jobs for us, in this article, I'll show you how to use it to do a simple asynchronous file upload. Because XMLHttpRequest object does not support file upload, the Connection Manager uses inline frame approach. Basically what the Connection Manager does is it creates an invisible IFRAME for file upload and parses the server response once the upload is completed. In the end, what you get is an illusion of Ajax-like file upload interaction. However, since this is an IFRAME, some Ajax events such as success or failure are not available in IFRAME method as they are available in regular Ajax request in YUI.
Test upload example online
CAPTCHA provides a simple yet effective way to tell humans and computers apart. The need of CAPTCAH arises because web pages which accept user input such as posting comment are vulnerable to automated spam. It is not a difficult task to write a script that could generate large amount of repetitive information and post them to a targeted page in short period of time. Unless the page is protected, it will soon polluted by those spam.
For instance, the site you are visiting, Code Central, receives over 10 junk comments everyday. Fortunately, WordPress uses an algorithm that can filter out most of these junk comments and flags them for review. The unfortunate part is that administrating them is laborious and frustrating - I don't want to delete them in a batch because I don't want to accidentally delete a comment that is submitted by a real user. So I decided to install a CAPTCHA to see if that is going to help.