base64_decode_to_file

FaxBackX Methods

The base64_decode_to_file method converts a BSTR in base64 format to it's original format and saves the output data to a file.  The output file may contain binary characters.

BOOL base64_decode_to_file(
  BSTR InputData, // Base64 data to decode
  BSTR FileName // File name to receive decoded data 
)


Parameters:
InputData Base64 data to decode

FileName The name of a file that receives the decoded data.  If the file exists previously, it is overwritten.

Return Value:
A BOOL status, based on the ability to write to the provided file name.

Example:
function GetMsgFile( MessageHandle, MessageFileToGet )
  {
  var Tl = xmlTlNew();
  xmlTlAddTag(Tl,"GET_FILE_FUNCTION",null);
  xmlTlAddTag(Tl,"REGISTERED_NAME","User1");
  xmlTlAddTag(Tl,"REGISTERED_PASSWORD","");
  xmlTlAddTag(Tl,"MESSAGE_HANDLE",MessageHandle);
  xmlTlAddTag(Tl,"CURRENT_FILESPEC",MessageFileToGet);

  var responseXML = xmlTlSend(Tl,
                              "\\\\FAX\\NETSAT",
                              "NETSAT",
                              2,
                              "http://netsat/casxml.asp");

  if (xmlGetTag(responseXML,"STATUS_NUM") == 0)
    {
    var content = xmlGetTag(responseXML,"CONTENT_DATA");

    if (FBX.base64_decode_to_file(content,"c:\\output.tif"))
      {
      return(true);
      }
    }
    
  return(false);
  }
See Also:
xmlTlNew, xmlTlAddTag, xmlTlSend, base64_decode, base64_encode