This content has been marked as final. Show 8 replies
I'm not sure about getting the full path, but you can get the name by creating an eventListener to listen for the SELECT event:
private function browseFiles():void
fileRef.addEventListener( Event.SELECT, fileSelected );
Then in the handler function you can get the filename with:
private function fileSelected(event:Event):void
var selectedFile:String = String(event.target.name);
You can get other info from event.target too.
Thanks a lot!
Indeed the event.target.name gives you the name of the selected file.
But when you put that in a variable and load it in an image source.. will it show the image?(air only)
How to get the full url to let the image object show the selected file?
Yes, but how do I get the full path if that's what I need?
You can't. Security issues forbid this.
Oops, that is for Flex in a browser, I do not know to do this in AIR apps, but the security constraint does not apply.
If that's the case, how does fileRef.upload() work? Somebody has to know the location of the file.
It's an odd policy. Knowing the path doesn't grant access to the file.
AIR has a File class that extends FileReference. The documentation states that you can do direct file I/O from an AIR application. Unfortunately for us, we prefer to run Flex in a browser.