I've got this code snipped that download successfully:
byte[] bytes;
bytes = Convert.FromBase64String(lehrling.passfoto);
Response.Clear();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "image/jpg";
Response.AddHeader("content-disposition", "attachment; filename=" + lehrling.vorname + "." + lehrling.nachname + ".jpeg");
Response.OutputStream.Write(bytes, 0, bytes.Length);
Response.End()
This works just fine. I get a jpeg file out of it. Now:
I created a for-loop that executes the code shown above for each bytearray:
for (int i = 0; i < anzahlBilder; i++)
{
//My Code here
}
Response.End()
I get anzahlBilder
from somewhere else. its not important for my question. I put Response.End()
outside of my for-loop because otherwise it ends after 1 image
got downloaded.
To Zip:
Now i want to create a .Zip file, which contains all my images. I dont know how to do it. Any Suggestions?