View Full Version : Browsing a remote directory with AS3 and AIR

01-12-2010, 06:04 AM
Hey all,

I'm writing an AIR application that will upload files to a remote web server. These files are images, bits of text in XML format etc. I'm also trying to write a web page builder within the uploading functionality so my mate can include some of the uploaded files so they show up on the webpage.

Now, what I need to be able to do is browse the remote directory where the image files are uploaded so my mate can select which ones to include.
I'm using <IMG> tags so I need to be able to see the source directory so I can include it with the 'src' parameter.

Now I can browse locally with Flash, but I know I should be able to FTP with AIR from a browse window as well.

If not, is it possible to print out a list of files in a directory with checkboxes next to them and then choosing like that?

Whatever is easiest.

01-12-2010, 07:20 AM
When you say "remote directory" what do you mean.


HTTP folder / file list as available with Apache etc ?
FTP directory listing ?
WebDav ?

i.e. where are your remote files, on a web server a ftp server or some other sort of server.

01-13-2010, 01:33 AM
All I mean is a directory of files on a server - I don't care what sort of technology I use to access it.

These files are on a web server but you can access the server via ftp as well.I can upload to the server fine using a combination of AIR and PHP scripts, so I assume I could also used PHP scripting to get a directory on the server?

01-14-2010, 03:58 AM
An example of what I mean is how, in windows (XP? not sure about Vista or Seven), you can type an FTP address into a file browsing box and you can connect to an FTP server and browse. You can also include a user name and password as parameters and login to a secure FTP. I would love to include this functionality into my AS3/AIR application.

The File class has a url parameter - it also has the  browseForOpen function which opens a browse dialog. The url parameter can be set before opening browse dialog to set the location on the local computer but, sadly, not on a remote http or ftp server address. if I manually type it in as above, though, it works.

Is there any way to force this browse dialog to do what I want? or to get it to redirect to the ftp address after opening a browse window?

Very frustrating.

01-15-2010, 04:04 PM
url refers to a path on the filesystem. As far as I know it's not a url in the sense of "http://www.actionscript.org". See: http://livedocs.adobe.com/flex/3/langref/flash/filesystem/File.html#url

Assuming your server is running LAMP your best bet is probably to create some php scripts for retrieving the contents of directories and uploading to them.

If you want to get really crazy you could probably use the new socket features of AIR 2 to create an FTP client in AIR.