Binary read for base 64 encoding
Posted on 2006-11-29
Using vb.net I need to read a file (whos path i kno) and convert the file into base 64 encoding within an xml node. Thus far I have attempted the following where cFile is the path of the file
fs = New FileStream(cFile, FileMode.Open, FileAccess.Read)
fs.Read(bytes, 0, bytes.Length)
str64 = Convert.ToBase64String(bytes)
then putting it into xml
If cFile <> Nothing Then
objField = objDOM.createElement("MSGFILE")
objField.dataType = "bin.base64"
objField.nodeTypedValue = str64
but receive the folowing error:
Procedure call or argument is not valid.