Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


decoding base64 data on client/browser?

From: Brandon@-----------.---------.---
To: NULL
Date: 3/2/2006 8:45:00 PM
My browser app sends a request to the server for a binary file.  The server 
receives the request, converts the file to base64, packages it up in XML, and 
returns it to the client/browser.

I can parse the returned XML just fine -- and find the base64 data -- but 
for the life of me cannot get it decoded back to it's original format.  The 
script below gets the filedata (using "nodeTypedValue") and saves it, but 
it's still the base64 representation of the file.

I've tried a million different things, and have searched all over the web 
and newsgroups, and I just can't seem to find a combination that gets me the 
original unencoded/decoded filedata.

Two other notes:
1. On the server side, I set the dataType = "bin.base64"
2. When it's back here on the client, if I alert() out the dataType for the 
node, it's null.  I thought that was interesting.

Here is my client/browser JavaScript:
 var getdocs_xmlhttp = new ActiveXObject("Msxml2.XMLHTTP.4.0");
 var getdocs_xmldoc  = new ActiveXObject("Msxml2.DOMDocument.4.0");
 getdocs_xmldoc.loadXML(reqxml);
 getdocs_xmlhttp.open("POST", "http://myserver/getbinfile.asp", false);
 getdocs_xmlhttp.send(getdocs_xmldoc);

  getdocs_xmldoc.loadXML(getdocs_xmlhttp.responseText); 
  //getdocs_xmldoc.save(folderpath + "download.xml");
  var root           = getdocs_xmldoc.documentElement;
  var inodelist      = root.childNodes;

...
parsing through for other data as well (i.e. filename)
...
   if( nitem.nodeName == "filedata" )
   {
     var objStream = new ActiveXObject("ADODB.Stream")
     objStream.Type = 1;
     objStream.Open();
     objStream.Write( nitem.childNodes.item(0).nodeTypedValue );
     objStream.SaveToFile( folderpath + tfilename, (1 & 2) );
     objStream.Close();
   }

ANY help would be MUCH appreciated.  Thank you all!

-b

 


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent