Google Picker API DocsUploadView setIncludeFolders

2019-09-15 18:59发布

问题:

I have the following :

        var uploadView = new google.picker.DocsUploadView().setIncludeFolders(true);

        var picker = new google.picker.PickerBuilder().
            addView(uploadView).
            setOAuthToken(oauthToken).
            setDeveloperKey(googleDeveloperKey).
            setCallback(uploadPickerCallback).
            build();

        picker.setVisible(true);

In no place during the process does it ask for the destination, it just uploads to the root and closes the dialog once the file is done uploading.

回答1:

This problem is caused by a long-standing bug with the Picker API. For more information, see https://groups.google.com/forum/#!topic/google-picker-api/xaHcET7JYLw.

The work-around is to enable multi-select, as described in the docs at https://developers.google.com/picker/docs/reference#Feature.

picker.enableFeature(google.picker.Feature.MULTISELECT_ENABLED);