Not able to save the zip file

Dec 14, 2016 at 12:55 PM
Hi,

Find a below simple code which i am trying to execute.
using (ZipFile zip = new ZipFile())
{
zip.AddFile("D:\Packages\Test.png");
zip.Save("D:\Athar\Myfile.zip");
}

I am getting an error @ zip.Save function and the issue is as below
"Access to the path 'D:\Athar\DotNetZip-e4gamapf.tmp' is denied."

Can you please let me know what am i missing to get this working fine.

Thanks and Regards,
Mohammed Athar.
Feb 8 at 4:55 PM
Edited Feb 8 at 4:56 PM
Think you need to look at the .Save overrides.
The way you have written your code will cause it to try to maintain the directory names also.
.Save can have a second parameter which is the path within the generated .zip file.
Set it to an empty string to add the files without a directory.
Hope this helps.