lotus-notes - Lotusscript:将文件从电子邮件转换为 base64 以 POST 方法发送
问题描述
我正在寻找一种通过 POST 方法将文件发送到服务器的方法。但首先我想将我的文件转换为 base64 以便我可以轻松地发送它们。只是,我在互联网上找不到任何解决方案。我什至不确定这样做是否是个好主意。
我尝试了几种方法,包括直接从附件转换或将它们保存在本地并检索它们,但没有任何效果。
这是我的代码:
pathname = "C:\temp"
Set db = Session.Currentdatabase
Set CurrentDocColl = db.Unprocesseddocuments
Set doc = CurrentDocColl.Getfirstdocument
While Not doc Is Nothing
Set item = doc.GETFIRSTITEM("Body")
If doc.HasEmbedded Then
ForAll attachment In item.EmbeddedObjects
Call attachment.ExtractFile (pathname & "\" & attachment.Name)
Set stream = session.Createstream()
stream.Open pathname & "\" & attachment.Name, "binary"
'I want retrieve the file in base64 here
data = 'file in base64
Set http=session.CreateHTTPRequest()
http.preferstrings = True
http.Post(url, data)
End ForAll
End If
Set doc=CurrentDocColl.Getnextdocument(doc)
Wend
此代码可以在我的代理中找到,该代理负责检索当前电子邮件中存在的信息。
有谁知道如何做到这一点?或者另一种方法来做同样的事情?
解决方案
您可以在 Julian Robicaux 的旧 NSFTools 网站上找到一些在 LotusScript 中处理 base64 数据的有用函数: https ://www.nsftools.com/tips/Base64v14.lss
推荐阅读
- mongodb - 如何在 MongoDB 中同时从两个集合中获取数据?
- php - 如何在没有mysql的情况下更新和删除html表中的特定值
- java - 将 `this` 从不同的片段传递给构造函数
- excel - 在一张纸上循环列标题并在另一张纸上找到完全匹配的 VBA 代码
- apache-spark - Pyspark - saveAsTable 在 show() 数据帧完美运行时引发索引错误
- python - 更新python后,我是否必须再次安装模块?
- vba - 在vba excel中保存大量字符串
- php - php字符串匹配检查没有得到预期的结果
- java - 在 Spring Boot 应用程序的 REST 调用中接受 Enum 的空字符串
- node.js - 从 Lambda 函数更新 dynamoDB 失败