I have files uploaded to sharepoint document library. Trying to use DotNetZip to get those files from document library, zip them and render the zip file. (Files in the document library are in PDF format).
Response.ContentType = "application/zip";
Response.AddHeader("content-disposition", "filename=" + "MyFiles.zip");
using (ZipFile zip = new ZipFile())
//Query the sharepoint document library and get SPFolder (folder in this case)
foreach (SPFolder folder in userFolder.SubFolders)
foreach (SPFile file in
byte br = file.OpenBinary();
using (MemoryStream stream = new MemoryStream())
stream.Write(br, 0, br.Length);
After downloading the zip file I am not able to open the zip file. It shows "zip file is invalid".