locked
zipping multiple files gives the error " the archive is either in unknown format or damaged" C# RRS feed

  • Question

  • User35525891 posted

    Hi Everone,

      I am trying to zip multiple files using  "Ionic.Zip" . Everything is working fine. but after download of the file, when i try to extract it, i am getting below error.

    " the archive is either in unknown format or damaged" . what may be the reason??? Here's my code.

    using System.IO;
    using Ionic.Zip;
    
      string filePath = string.empty;                       
    ZipFile zip = new ZipFile();
                            Response.Clear();
                            Response.AddHeader("Content-Disposition", "attachment; filename=DownloadedZipFileTest.zip");
                            Response.ContentType = "application/zip";
                            for (int i = 0; i < OrderDetailList.Count; i++)
                            {
                                string filName = OrderDetailList[i].OriginalFileName;
                                filePath = Server.MapPath("~/FinalFiles/" + filName);
                                zip.AddFile(filePath, string.Empty);
                            }
                            zip.Save(Response.OutputStream);

    I have files in specified folder...

    Thanks & Regards,

    Manikandan.

    Friday, September 7, 2012 3:18 AM

Answers

  • User-1752700239 posted

    Hi Mani,

     Please check whether you registered inculded .dll in you machine.

     Please check it may help..........

    http://dotnetzip.codeplex.com/

    http://forums.asp.net/t/1729106.aspx/1

    Thanks

    Vijayakumar Pa

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 10, 2012 3:57 AM

All replies

  • User1368300014 posted

    Ionic.zip is any third party dll.

    it will create a zip file but the content may not be there inside it.

    if u have any IDE for ionic try it manually for zipping folders. they u came to know.

    For better way..try to make all your folders as byttecode and save the byte code as the zip file.. it will be more help full for you.

    Friday, September 7, 2012 3:33 AM
  • User35525891 posted

    For better way..try to make all your folders as byttecode and save the byte code as the zip file.. it will be more help full for you.

    Hi Shree_ars,

      Can you please explain it little breifly about how to create bytecode.. plz

    Thanks & Regards,

    Manikandan M

    Friday, September 7, 2012 3:42 AM
  • User-1752700239 posted

    Hi Mani,

     Please check whether you registered inculded .dll in you machine.

     Please check it may help..........

    http://dotnetzip.codeplex.com/

    http://forums.asp.net/t/1729106.aspx/1

    Thanks

    Vijayakumar Pa

     

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, September 10, 2012 3:57 AM