Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - decoding base64 data on client/browser? [Thread Next] RE: decoding base64 data on client/browser?To: NULL Date: 3/8/2006 6:57:00 AM Hi,
Have you had a look at this article
http://support.microsoft.com/kb/254388/en-us.
it'd restrict your browsers to .net clients but should get the work done..
--
Ravi Shankar
"Brandon" wrote:
> 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
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
