Sample code for 30+ languages & platforms
Visual Basic 6.0

Base64 Encode a File

_LANGUAGE_ to Base64 encode the contents of a file.

Chilkat Visual Basic 6.0 Downloads

Visual Basic 6.0
Dim success As Long
success = 0

' Get the contents of a file into a base64 encoded string:
Dim fac As New CkFileAccess
Dim strBase64 As String
strBase64 = fac.ReadBinaryToEncoded("c:/data/something.pdf","base64")
If (fac.LastMethodSuccess <> 1) Then
    Debug.Print fac.LastErrorText
    Exit Sub
End If

' Now write the string to a file:
success = fac.WriteEntireTextFile("c:/data/something_pdf_base64.txt",strBase64,"us-ascii",0)
If (success <> 1) Then
    Debug.Print fac.LastErrorText
    Exit Sub
End If

Debug.Print "Success!"