'I can't seen to access the added object property in app script, this property is visible in js though. e.fn is undefined in code.gs
I can't seen to access the added object property in app script, this property is visible in js though. e.fn is undefined in code.gs
HTML
<input type="button" value="Upload" onclick="jsupload(this.parentNode)"/>
JS
function jsupload(ee) {
if (confirm("Upload picture of " + '[' + fullinfo[1] + '] ' + fullinfo[2] + '?!?') == true) {
// ee['fn'] = "hey"
Object.defineProperty(ee, 'fn', {
value: 'hey'
})
google.script.run.withSuccessHandler(showResult).upload(ee)
}
}
code.gs
function upload(e) {
var destination_id = 'XXXXXXXXXXXXXXXX'
var img = e.imageFile
var contentType = 'image/png'
var destination = DriveApp.getFolderById(destination_id)
var img = img.getAs(contentType)
var newFile = destination.createFile(img).setName(e.fn) // e.fn undefine
var newFileLink = "http://drive.google.com/uc?export=view&id=" + newFile.getId()
return newFileLink
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
