VBScript
VBScript
Get Contents of File as Base64
See more Encryption Examples
Demonstrates how to read the contents of a file and convert to a base64 string.Chilkat VBScript Downloads
Dim fso, outFile
Set fso = CreateObject("Scripting.FileSystemObject")
'Create a Unicode (utf-16) output text file.
Set outFile = fso.CreateTextFile("output.txt", True, True)
success = 0
set bd = CreateObject("Chilkat.BinData")
success = bd.LoadFile("qa_data/jpg/starfish.jpg")
If (success = 0) Then
outFile.WriteLine("Failed to load file.")
WScript.Quit
End If
outFile.WriteLine(bd.GetEncoded("base64"))
' If you want mult-line base64:
outFile.WriteLine("--")
outFile.WriteLine(bd.GetEncoded("base64_mime"))
' If you want hex..
outFile.WriteLine("--")
outFile.WriteLine(bd.GetEncoded("hex"))
' etc.
outFile.Close