且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

有关如何在Google AppMaker中上传文件的示例或模板

更新时间:2022-02-15 08:35:46

App Maker开箱即用地上传文件的唯一方法是Drive Picker小部件,默认情况下,它将文件上传到当前用户的Drive根文件夹. Drive Picker的API允许更改默认上传文件夹,但是App Maker不允许在此时显示设置. 但是它具有onPickerInit事件,可为您提供 pickerBuilder 可用于自定义选择器:

The only way to upload files that App Maker provides out of the box is Drive Picker widget and by default it uploads files to current user's Drive root folder. Drive Picker's API allows to change default upload folder, however App Maker doesn't expose the setting at this time. But it has onPickerInit event that provides you with pickerBuilder that you can use to customize your the picker:

// onPickerInit Drive Picker's event handler
var uploadView = new google.picker.DocsUploadView();
uploadView.setParent('ID of the folder to upload to');

pickerBuilder.addView(uploadView);

此技巧适用于个人文件夹和Team Drive文件夹.

This trick works both for personal and Team Drive folders.

注意

setParent似乎仅与启用MULTISELECT_ENABLED驱动器选择器功能结合使用.

It seems that setParent works only in combination with MULTISELECT_ENABLED drive picker feature enabled.