Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

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.

— asked October 6th 2010 by Jim Chapman
  • openfilechooserdialog
0 Comments

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.

    — answered February 20th 2011 by Patrick Mounteney
    permalink
    0 Comments
  • 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);
    });
    }

    — answered May 23rd 2011 by Joe Boggs
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.