Hi All,
I am using infopath 2007.
In my sharepoint form library, I have an infopath form which has an attachment field.
This is my requirement --> On button click, I need to programmatically attach a zip file to that attachment field.
I know attachments in infopath are stored in base64 encoded string.
Till now I am successfully able to load the zip file into byte[] array and convert it into base64 string. This is the code snippet:
string strFilePath = "C:\\Test.zip";
FileStream fs = new FileStream(strFilePath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] data = new byte[fs.Length];
fs.Read(data, 0, data.Length);
fs.Close();
string strBase64 = Convert.ToBase64String(data);
After this how do I set the value of infopath attachment field as strBase64??
Is this is the right approach or am I going wrong??
Need help.
Thanks,
Jaimin