File Upload with Apollo and JavaScript

Written by on May 25th, 2007 in Ajax News.

Kevin Hoyt has posted a very detailed entry on a file upload component that he created with Apollo and JavaScript:

Let’s say that you take a lot of pictures. You take pictures, but you don’t want to think about how to upload them. You’d really like an application to monitor a directory for new images, and then upload them to a server. That kind of rules out the browser - it’s not going to be watching a directory on your desktop for image files, and then automatically uploading them. What about Apollo though? Couldn’t an Apollo application monitor a directory for me? Sure! Let’s make it happen…

The article walks you through the example, using jQuery, and gives details on the Apollo APIs:

JAVASCRIPT:

  1.  
  2. // Watcher logic
  3. $( document ).ready( function() {
  4.  
  5.         // Check for directory
  6.         var watching = runtime.flash.filesystem.File.desktopDirectory;
  7.         watching = watching.resolve( dir );
  8.  
  9.         // Create it if it doesn’t exist
  10.         if( !watching.exists ) {
  11.                 watching.createDirectory();
  12.         }
  13.  
  14.         // Do the initial check and updating of the UI
  15.         update();
  16. } );
  17.  

Source: Ajaxian
Original Article: http://ajaxian.com/archives/file-upload-with-apollo-and-javascript

Leave a Reply

You must be logged in to post a comment.



Site Navigation