Save base64-encoded embedded picture to file

  • Thread starter Jörn Willhöft
  • Start date
J

Jörn Willhöft

Hi there,

I have a form that has embedded picture attachments. IP stores these
internally as base64-encoded xml. Now I need to save these pictures into
files.

I tried the following JScript:

var node =
primaryDom.selectSingleNode("/dfs:myFields/my:pictures/my:rep_pict");

var fileSystem = new ActiveXObject("Scripting.FileSystemObject");
var file = fileSystem.CreateTextFile("c:\\test.jpeg", true);
file.write(node.text);
file.close();
fileSystem = null;

This does save the contents of the node to the file test.jpeg, BUT it is
still base64 encoded.

How do I decode the base64?
AND, if necessary, how do I create a non-text file from JScript?

Thank you very much,
Jörn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top