openFileChooserDialog
Ok, I'm a noob to appcelerator… please excuse basic question…
For a desktop app I'm successfully opening a fileChooserDialog. I can successfully select a file and my callback function fires. How do I access the name and path of the chosen file in the callback function? What am I missing?
TIA - for your help.
2 Answers
-
Jim - after 5 months you'd think somebody would have thought to offer advice!
Having spent two hours trying to figure this out too I have been able to use the callback to get a "StaticBoundList" with the file path tantalisingly tacked on the end, but how to extract the path as a string is allusive.
Leaving the callback aside, the API actually states that the openFileChooserDialog method's return type is a string, but it seems to return nothing. So getting the path to the selected file must only be possible via the callback - if only there was clue somewhere as to what the magic word is to extract it from the event. It's not "e.name", "e.path", "e.imagepath", "e.nativePath" or anything I could think of.
So not much help - but maybe this will jog somebody who actually knows into action.
-
I think you guys are looking for something like this:
function browseForFile(){
var curwin = Titanium.UI.getCurrentWindow();
curwin.openFileChooserDialog( function(fileResponse){
var file = Titanium.Filesystem.getFile(fileResponse[0]);
alert(file);
});
}