用xml非常方便。 set xmldoc = new DOMDocument Set root = xmldoc.createElement("file") xmldoc.appendChild (root) Set cNode = xmldoc.createElement("code") root.appendChild (cNode)
cNode.dataType = "bin.base64"
Open ".bmp" For Binary Access Read Lock Read As #1 ReDim arr(FileLen(".bmp")) Get #1, , arr Close #1 cNode.nodeTypedValue = arr xmldoc.save (".xml") 任何文件都可以这样
J2EE中有javamail包(mail.jar or mailapi.jar),其中com.sun.mail.util.base64...類實現了base64編碼
set xmldoc = new DOMDocument
Set root = xmldoc.createElement("file")
xmldoc.appendChild (root)
Set cNode = xmldoc.createElement("code")
root.appendChild (cNode)
cNode.dataType = "bin.base64"
Open ".bmp" For Binary Access Read Lock Read As #1
ReDim arr(FileLen(".bmp"))
Get #1, , arr
Close #1
cNode.nodeTypedValue = arr
xmldoc.save (".xml")
任何文件都可以这样