Adding binary file to XML data

Hi,

I have a requirement to add attachment to XML data and send it using http post. The attachment could be a text file or a binary file (Picture or PDF or anything). The limit on attachment file size is 5 MB.

Could any one please let me know what could be the best way of doing this? One of the approach which came in my mind is mentioned below. Could anyone please let me know if this is a good way of doing it.

Get the attachment from the FTP location, get the data in string and use base64 encoding to encode the data and put it in a xml field and send it along with XML data in http post.

Will the file size of 5 MB could have a negative impact on processing time?

I would be greatly obliged if you could help me in this regard.

Thanks,
Syed

Hi Syed,

base64 binary data is the best way to send binary data in xml in my opinion (at least for normal size files up to 10 MB). i have used this and didn’t see any performance issue.

There are other ways like using mime types - i’m not sure of how to do or advantages.
Anyone worked on these should give more details.

-regards,
DC

Hi Deepan,

Thanks for the help.

Regards,
Syed

Search the forums and the web for “XML with attachments.”

Hi Rob,

Thanks for the help. I have searched the web and found two simple ways.
One is to use direct base64 encoding and other is to use MIME.

I just wanted to know if there is any advantage in using MIME over the simple base64 encoding method interms of processing speed and others.

Could you please throw some light on this.

Regards,
Syed

MIME will also use base64 encoding for binary data.

Ok. Thank you Rob.