I am trying to Base64 encode a MS Word document on CF 7. However, when I try to
decode and save the file and open it in word, it only shows raw characters
instead of the original document. I must be doing something wrong. I tried
using both ToString and ToBinary to decode the document, the results were not
much different. The following is the sample of the code I tried to test this
functionality <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html> <head> <title>Base 64 Decode Test</title> </head> <body> <CFFILE
ACTION='READ' FILE='d:\temp\VendorFieldDefinitions.doc' VARIABLE='strFiledata'>
<CFSET strEncodedFile = ToBase64(strFiledata)> <CFSET strWordDoc =
ToString(strEncodedFile)> <!--- Tried ToBInary(strEncodedFile) as well --->
<CFFILE ACTION='WRITE' FILE='d:\temp\decode.doc' output='#strEncodedFile#'>
</body> </html> If anyone has experience with this or have any suggestions,
please let me know. Thank you.