在Google App脚本中上传文件时无法获取文件名 [英] Cannot get file name when upload file in google app script
本文介绍了在Google App脚本中上传文件时无法获取文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
上传文件完成后,我想获取文件名.我有这个示例,并遵循以下代码.
I want to get file name when upload file finish. I have this example and follow this code.
但是,当我从以下代码获取文件名时:
However, when I get file name from following code:
var fileBlob = e.parameter.thefile;
结果总是返回字符串"FileUpload".
The result is always return string "FileUpload".
如何获取文件名?非常感谢.
How can I get the file name? Thank you so much.
推荐答案
您正在遵循的示例脚本会生成DocsList getName()
,以便在示例中扩展功能……
The example script you were following produces a DocsList File
object. This object has a method getName()
so to extend the function in the example…
function doPost(e) {
// data returned is a blob for FileUpload widget
var fileBlob = e.parameter.thefile;
var doc = DocsList.createFile(fileBlob);
var fileName = doc.getName();
}
旋转一下.
这篇关于在Google App脚本中上传文件时无法获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文