KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Using Base 64 Encoding and Decoding
PRODUCT: 4D Internet Commands | VERSION: 2003.3 | PLATFORM: Mac & Win
Published On: July 8, 2004

To encode or decode in Base 64 format, use the plugin 4D Internet Commands. The methods you want to use are IT_Encode and IT_Decode, respectively. You must first write what you want to encode or decode into a file before any encoding or decoding can occur. After the encoding or decoding, the result will be returned in another file. You will need to open the file and read in the contents into 4D. The mode parameter tells 4D in which format you want to encode or decode, in this case the mode is 2.

IT_Decode ($file_to_decode; $decode_dFile; $mode)

IT_Encode ($file_to_encode; $encoded_File; $mode)

The trick is to remember that you need to convert what you want to encode/decode into a file first. Then, after the procedure, if need be, convert the file back into 4D.