2
Vote

After creating .zip I get error when opening the file

description

After I create the text file using this code.
 
    Using zip = New ZipFile()
 
        For Each row As GridDataItem In RadGridDocs.MasterTableView.Items
 
            Dim clientSelectColumn As CheckBox = DirectCast(row("ClientSelectColumn").Controls(0), CheckBox)
 
            Dim chkBox = clientSelectColumn.Checked
 
            If chkBox = "True" Then
 
                Dim txtDocument As TextBox = row.FindControl("txtDocumentFileName")
                Dim fileName As String = txtDocument.Text
 
                Dim txtDocumentPath As TextBox = row.FindControl("txtDocumentPath")
                Dim documentPath As String = txtDocumentPath.Text
 
                Dim fullpath As String = Server.MapPath("~") + "\" + documentPath + fileName
 
                fullpath = Replace(fullpath, "/", "\")
 
                fullpath = Replace(fullpath, "\", "\\")
 
                'Code to Zip a Folder.
 
                zip.AddFile(fullpath)
 
            End If
 
        Next
 
        zip.Save(Response.OutputStream)
 
    End Using

 

 
I am trying to send this out via a asp.net application using .NET 3.5. I keep getting the error "Cannot open file: it does not appear to be a valid archive."
 
Are there any ideas?

file attachments

comments

DexMiK wrote Aug 31, 2011 at 9:30 PM

as always try zip.ParallelDeflateThreshold = -1; (in vb code) before calling zip.Save(...) and see if this helps (its a workaround at the moment, since this seems to be a bug - not sure yet, waiting for cheeso to find out)

billgraziano wrote Sep 25, 2012 at 3:15 PM

I'm also getting this error.