0

i have tried below code, and it is creating zip file . but the problem is when i unzip it , i have seen that it is saving my file (csv file) but with all root folder. i just want that when i unzip my zip file, there should be only csv file , not all root folder.

ZipFile zipFile = new ZipFile();
zipFile.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
zipFile.Password = "password";
var imagePath = Server.MapPath("~/Content/Report.csv");
zip.AddFile(imagePath, string.Empty);    
var saveToFilePath = HttpContext.Current.Server.MapPath("~/Report.zip");
zipFile.Save(saveToFilePath);

Can anyone please help me .?

B.K.
  • 9,982
  • 10
  • 73
  • 105
User5590
  • 1,383
  • 6
  • 26
  • 61

1 Answers1

0

If you want to store only files in zip without folder which contains these files then you must use:

zipFile.Options.StorePath = StorePathMode.NoPath;
Snake Eyes
  • 16,287
  • 34
  • 113
  • 221