The following code works on my machine but not in server:
using (ZipFile zipFile = ZipFile.Create(outPath))
{
if (!includeFolders)
{
zipFile.NameTransform =
new ZipNameTransform(Path.GetDirectoryName(fileNames[0]));
}
foreach (string Fil in fileNames)
{
zipFile.BeginUpdate();
zipFile.Add(Fil.ToLower());
zipFile.CommitUpdate();
}
}
It creates an empty zip file and throws this exception:
Cannot access a disposed object. Object name: 'ZipFile'.
anyone else encountered this error? is there an alternative way or library to zip files without folders?