p. This weekend I found an interesting article over at anyexamples.com on using AJAX and PHP to do asynchronous file uploads. The article is titled “PHP AJAX example: asynchronous file upload”:http://www.anyexample.com/programming/php/php_ajax_example__asynchronous_file_upload.xml and it’s part of their growing collection of PHP tutorials. Let’s take a quick peek at it, shall we?
bq. Asynchronous file uploads is quote popular feature in modern AJAX web-applications. However standard AJAX classes (XmlHttpRequest) does not have capabilities to process or send files selected with “file dialog” (input type=”file”). This article contains example application (trivial file-sharing service, like rapidshare, megaupload or yousendit) which uses embedded frames (IFRAME) to upload file. While file is uploaded to hidden frame, user can still access web-page and fill “file description” field.
p. The article goes on to deliver what it promises. The first few paragraphs give you the basics of “WHY” and then the rest is just source code. This isn’t really a tutorial I’d recommend for those new to PHP or AJAX but for veteran programmers, it’s the kind of tutorial you like. A quick description of what they want to show you and then the code. The sample code is reasonably documented and easy to follow. All-in-all, this is a good one to spend an evening with.
p.s., if you like this tutorial, vote for it at dzone.com by clicking the little icon below.