所以基本上任务很简单,但我没有找到任何可行的解决方案来解决我的问题。我的网站上有一个巨大的上传脚本(目前是本地主机),但让我们将所有复杂性降低到唯一必要的程度。
所以我只想使用 Google App Script 将单个文件上传到 Google Drive 并接收它的 URL 以将其保存在 var 中,以便在我的函数中稍后处理该信息。
现在的问题是我的网站上已经有了表单,我不希望 script.google.com 中的表单作为额外的 html,我想将我的用户输入传输到 Google App Script,然后将其上传到 google drive 并返回 url回到我的网站,我可以将它保存到一个 var 中。
我现在的问题是,我不能把所有的东西放在一起。
这是我网站上的表格(简化版):
<form name="myForm" method="post">
<!-- <form name="first-form"> -->
<input type="text" placeholder="Name" id="myName">
<input type="file" name="myFile" id="myFile">
<button onclick="UploadFile()" type="submit">submit</button>
</form>
Run Code Online (Sandbox Code Playgroud)
那么如何将我的信息上传到谷歌驱动器中并获得结果呢?如何在不使用 iFrame 或其他任何东西的情况下推送 Google App Script 中的数据?
谢谢你!
**** 工作示例,如果 html 在 scripts.google.com 中 ****
GS
function doGet(e) {
return HtmlService.createHtmlOutputFromFile('forms.html').setTitle("Google File Upload by CTRLQ.org");
}
function uploadFileToGoogleDrive(data, file, name, email) {
try …Run Code Online (Sandbox Code Playgroud)