Appcelerator Titanium - openFileChooserDialog does not exist: How to open a dialog to browse for a file?

411 views Asked by At

I currently have the following code:

function openFileChooser() {
    var options = {
        title : "Select file to upload to cloud...",
        types : ['mp3', 'm4a', 'aac', 'wav', 'aif', 'aiff'],
        typesDescription : "Audio files",
        path : Ti.Filesystem.applicationDataDirectory
    };

    //does not work
    Ti.UI.openFileChooserDialog(function(filenames) {
        fileSelected = filenames[0];
    }, options);

    $.filePath.text = fileSelected;
}

Basically, I am trying to open up a dialog for the user can browse for an audio file. I have seen examples of openFileChooserDialog on several sites, but my app crashes when it runs, stating that it does not exist.

Is there anything I can do where I can open a dialog for the user to browse for an audio file?

1

There are 1 answers

1
StephenFeather On

The openFileChooserDialog was part of the Titanium Desktop API, which was spun off to TideSDK. If this is a mobile project, that API call doesn't exist in the mobile space.