我正在尝试使用Google Picker将文件上传到Google云端硬盘中的特定文件夹。我刚刚上传到根文件夹时一切正常,但即使在我下面的代码中指定父文件夹之后,文件仍然会转到根文件夹,而不是我指定的文件夹。我确定folderID是正确的,因为我在其他地方使用相同的ID在我的GAE应用程序中创建纺织品,并将它们放在子文件夹中。我的代码如下:
function createPicker() {
// Create a view to search images.
var view = new google.picker.View(google.picker.ViewId.DOCS);
view.setMimeTypes('image/png,image/jpeg');
// Use DocsUploadView to upload documents to Google Drive.
var uploadView = new google.picker.DocsUploadView().setParent('THE Parent folder ID');
var picker = new google.picker.PickerBuilder().
addView(view).
addView(uploadView).
setAppId("pressomatic").
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
答案 0 :(得分:4)
你必须添加:
enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
在你的情况下,它变为:
var picker = new google.picker.PickerBuilder().
enableFeature(google.picker.Feature.MULTISELECT_ENABLED).
addView(view).
addView(uploadView).
setAppId("pressomatic").
setCallback(pickerCallback).
build();
picker.setVisible(true);
}
答案 1 :(得分:1)
这是Picker API论坛中记录的错误:https://groups.google.com/forum/#!topic/Google-Picker-API/xaHcET7JYLw
你必须添加:
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
在你的情况下,它变为:
var picker = new google.picker.PickerBuilder()
.enableFeature(google.picker.Feature.MULTISELECT_ENABLED)
.addView(view)
.addView(uploadView)
.setAppId("pressomatic")
.setCallback(pickerCallback)
.build();
希望这有帮助。