Hi all,

I am writing my application in ExtJS and PHP, and I need actionscript to build a folder browser just to get the folder path.

Unfortunately, I am unfamiliar with ActionScript.

However, upon searching on the web, I have found this little script:

import flash.filesystem.File;
import flash.events.Event;

var directory:File = File.documentsDirectory;

try
{
    directory.browseForDirectory("Select Directory");
    directory.addEventListener(Event.SELECT, directorySelected);
}
catch (error:Error)
{
    trace("Failed:", error.message);
}

function directorySelected(event:Event):void 
{
    directory = event.target as File;
    var files:Array = directory.getDirectoryListing();
    for(var i:uint = 0; i < files.length; i++)
    {
        trace(files[i].name);
    }
}

Does anyone know how to integrate this with my ExtJS/Javascript and PHP?

I am open to other options as well.

Many thanks!!!

Member Avatar for rajarajan2017

First of all, you have to carefully note one thing, this code would not work in flash with web application (which has the possibility to connect php/Javascript). This will work only in AIR application which will work as an application. So it would not help you to integerate php.

Infact, I will try to give possibility if any...

commented: *nods* +11

Thanks.

Yeah, I've tried with SWFUpload, and flash won't help either.
Will look at applets next.

Member Avatar for rajarajan2017

I think the required output you can get it from php itself!!!!!

No, php can't get the local directory path...

No web page is allowed to browse the local folders of the client computer. This is a security violation. It is illegal in many countries.

The only function allowed to have partial access to the folders of the client computer is the ftp upload/download function, under the direction of the client user himself.

You can do browsing of the folders of the portion of the server the web page owner has control over.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.