Archived Forum Post

Index of archived forum posts


XML, node's content as Zip file Base64 encoded

Jan 07 '15 at 14:49


I have a file that must be zipped (deflate with header and able to be unzipped with other tools or manually) base64 encoded and integrated as a node's content in XML. I doubt SetBinaryContentFromFile would be the right option. Could anybody give me a tip where and how to start? Do I need to start with 'Chilkat_9_5_0.Zip and AppendOneFileOrDir to create zip file and then SetBinaryContentFromFile to import it in XML as base64 or there is more elegant way?

Thanks a lot


That should actually be the one you want. It has a Zip option that should Zip Archive it. You can test that by adding your file, inspect the element, copy out the base64 text, decode it, the first 2 bytes should be PK if it is a zip file.

If it is not, then use the ChilkatZip component, and then use SetBinaryContentFromFile or SetBinaryContent if you have it as a byte array, it will base64 it for you.