Lianja
Lianja
Base64 Encode a File
_LANGUAGE_ to Base64 encode the contents of a file.Chilkat Lianja Downloads
llSuccess = .F.
// Get the contents of a file into a base64 encoded string:
loFac = createobject("CkFileAccess")
lcStrBase64 = loFac.ReadBinaryToEncoded("c:/data/something.pdf","base64")
if (loFac.LastMethodSuccess <> .T.) then
? loFac.LastErrorText
release loFac
return
endif
// Now write the string to a file:
llSuccess = loFac.WriteEntireTextFile("c:/data/something_pdf_base64.txt",lcStrBase64,"us-ascii",.F.)
if (llSuccess <> .T.) then
? loFac.LastErrorText
release loFac
return
endif
? "Success!"
release loFac