pathairfilereference

Air app, get full path when opening file with FIleReference


I'm using FileReference to open a file, but I can only get the file name that the user selected, not the full path. Can I get the complete file path, or is there a security issue? Or should I use another approach?

private function openClicked(e:MouseEvent):void {
    var fr:FileReference = new FileReference();
    fr.browse();
    fr.addEventListener(Event.SELECT , fileSelected);
}

private function fileSelected(e:Event){
    trace ("file sel " + e.target.name);
        //do stuff

}

Solution

  • The FileReference class does not allow that. You'll need to use the File class instead.