如何将setAttachment与ImageView一起使用

时间:2013-12-11 16:14:34

标签: dominotogo

我尝试使用setAttachment方法将照片附加到Notes文档。我的attachPhoto.xml视图中有一个包含我的照片的ImageView:

<ImageView id="AttachImageView" image=""/>

当用户拍摄或选择照片时,会设置图像属性。

在我的attachPhoto.js文件中,我有以下内容:

var doc = databaseName.createDocument();
doc.setAttachment($.AttachImageView.getImage(), "Attachment");
doc.save();

当我进行同步并上传更改时,我收到错误消息:

"EXCEPTION: NotesDatabase.ynUploadFiles, Error: Invalid type passed to function".

对于我出错的地方有任何帮助表示赞赏。

1 个答案:

答案 0 :(得分:0)

getImage()返回一个File对象,但对于setAttachment(),您需要将该文件的路径作为字符串。 getImage()。getNativePath()应该可以工作。