Example or template on how to do file upload in Google AppMaker

人盡茶涼 提交于 2019-12-29 08:24:47

问题


can anyone share with me the .zip file for Document Approval template because I can't open it since I'm not using GCS but I wanted to go through how they using Drive Picker widget to upload file and so on.

another thing is, where the file will be uploaded to? is it the owner's Drive? is it possible to upload the document to a single folder of a Team Drive instead? Really appreciate it if anyone can share with me some thoughts or any API will do, Thanks!


回答1:


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);

This trick works both for personal and Team Drive folders.

Note

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




回答2:


Right now, looks appmaker seems to ALWAYS adds an upload tab itself, so if I add another uploadview, I end up with two upload tabs, the first one uploading to the main folder and selected by default :(

My best guess for a workaround is to not add my own upload view, let the picker upload the file to the main folder, and move the file in the onSelect hook to its final destination. If there's a better way, I'd love the hear.



来源:https://stackoverflow.com/questions/49666940/example-or-template-on-how-to-do-file-upload-in-google-appmaker

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!