Sample code for 30+ languages & platforms
Lianja

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 Lianja Downloads

Lianja
llSuccess = .F.

loBd = createobject("CkBinData")

llSuccess = loBd.LoadFile("qa_data/jpg/starfish.jpg")
if (llSuccess = .F.) then
    ? "Failed to load file."
    release loBd
    return
endif

? loBd.GetEncoded("base64")

// If you want mult-line base64:
? "--"
? loBd.GetEncoded("base64_mime")

// If you want hex..
? "--"
? loBd.GetEncoded("hex")

// etc.


release loBd