Skip to main content
September 6, 2006
Answered

converting binary string to a file

  • September 6, 2006
  • 2 replies
  • 380 views
I need some help in decoding a binary string. I recieve a binary string from a webserivce that represents a .pdf file. I want to be able to view that file on my en somehow. I have played around with binardecode and what not but am having no luck. When i do a isbinary() check on the string it says that the file is not binary but it is. ( I encoded the file the webservice is sending me the same way and they are identical.) Anyone got any ideas?
This topic has been closed for replies.
Correct answer
Normally, you do something like this:

<CFSET zBinData = BinaryDecode (ENCODED_FILE_DATA, "Base64");

<CFFILE action="write" file="C:\YourDir\FileName.pdf" output="#zBinData#" addnewline="No">


Then link to or view the PDF in the normal way.

2 replies

September 7, 2006
Thanks that did it
Correct answer
September 6, 2006
Normally, you do something like this:

<CFSET zBinData = BinaryDecode (ENCODED_FILE_DATA, "Base64");

<CFFILE action="write" file="C:\YourDir\FileName.pdf" output="#zBinData#" addnewline="No">


Then link to or view the PDF in the normal way.