jibon57 / nativescript-mediafilepicker

A complete file picker solution for NativeScript
Apache License 2.0
51 stars 39 forks source link

Folders showing up as files while using custom file picker #81

Closed sgpatel5 closed 5 years ago

sgpatel5 commented 5 years ago

See below image (On Android Emulator): -

image

Code: -

onChooseLocalFile() : void { let extensions = [];

    if (app.ios) {
        extensions = [kUTTypeContent]; // you can get more types from here: https://developer.apple.com/documentation/mobilecoreservices/uttype
    } else {
        extensions = ['*'];
    }

    let options: FilePickerOptions = {
        android: {
            extensions: extensions,
            maxNumberFiles: 1
        },
        ios: {
            extensions: extensions,
            multipleSelection: false
        }
    };

    let mediafilepicker = new Mediafilepicker(); 

    mediafilepicker.openFilePicker(options);

    mediafilepicker.on("getFiles", function (res) {
        let results = res.object.get('results');
        console.dir(results);
    });

    mediafilepicker.on("error", function (res) {
        let msg = res.object.get('msg');
        console.log(msg);
    });

    mediafilepicker.on("cancel", function (res) {
        let msg = res.object.get('msg');
        console.log(msg);
    });

}
jibon57 commented 5 years ago

You should add extension type extensions = ['txt', 'pdf'];

sgpatel5 commented 5 years ago

You should add extension type extensions = ['txt', 'pdf'];

i applied the extensions to only show doc & docx files, but i still do not see folder list. What if my files are buried deep inside folders somewhere? see image below: -

image

dpdragnev commented 4 years ago

Did you ever find a solution? I am facing the same issue.

Why is this issue even closed? I don't see a solution provided.

erkanarslan commented 4 years ago

It seems that the maintainer does not care about issues as long as it works for his own use case.