I'm downloading .TIFF images from the web via a WebService. I receive the images as byte[]. I want to download these images and I'm doing so with this code:
Response.ClearContent();
Response.ContentType = MimeType; // images/tiff
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + Convert.ToString(FileName) + "\"");
byte[] FileContent = Convert.FromBase64String(getFileContentAsBase64String()); // Get the file content
Response.BinaryWrite((byte[])FileContent);
Response.Flush();
This is working as intended with one file. I have a case where I want to download multiple files at the time but displaying them as a single file. At the moment I'm using this code, but it is not working as intended. It's downloading the image, but only the first one. I'm not sure what happens with the 2nd and 3rd.
long PageNoLong = long.Parse(PageNo); // Number of pages (files), in this case we have 3
Response.ClearContent();
Response.ContentType = MimeType;
string FileName = "filename.tiff";
Response.AddHeader("Content-Disposition", "attachment;filename=\"" + Convert.ToString(FileName) + "\"");
//In this case, the loop loops three times, returning three byte[] which i write to the Response
for (int i = 1; i < PageNoLong+1; i++)
{
byte[] FileContent = Convert.FromBase64String(getFileContentAsBase64String());
Response.BinaryWrite((byte[])FileContent);
}
Response.Flush();
How do I merge these three byte[] into a single .tiff file?