Friday, May 25th, 2007
File Upload with Apollo and JavaScript
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:
-
-
// Watcher logic
-
$( document ).ready( function() {
-
-
// Check for directory
-
var watching = runtime.flash.filesystem.File.desktopDirectory;
-
watching = watching.resolve( dir );
-
-
// Create it if it doesn't exist
-
if( !watching.exists ) {
-
watching.createDirectory();
-
}
-
-
// Do the initial check and updating of the UI
-
update();
-
} );
-













It looks very nice. I guess it helps to visualize such a unpredictable uploading process. Thanks for your information.
Reminds me of ActiveX.
And i wrote upload progress bar in JS&perl
ì¢‹ì€ ê¸€ ë³´ê³ ê°‘ë‹ˆë‹¤..