This project is read-only.

is there a limit of how many files you can list?

Apr 12, 2010 at 4:25 PM
Edited Apr 12, 2010 at 5:25 PM

I'm getting a corrupted zip file whenever i add a 91st entry file to download. Not 91 files to zip, but rather the 91st file available to download.

What I have is a list of files, like the code shown below. I select the files I want to zip and download through the checkbox and then click submit. Everything seems to work ok, but if I had another file as seen below to the html list, any combination of files that i choose to download afterwards, will always give me a zip error.


	<tr >
		<td border="1" width="" align=center>
	    <input id="Checkbox89" name="multiple11" value="C:\Inetpub\wwwroot\Webiz\Portal\Docs\docs\2008StdEnglishFinal.pdf" type="checkbox" default=""/>
		<td border="1" width="8%" align=center>
		<p ><a href="docs/2008StdEnglishFinal.pdf">2008</a></p>

		<td border="1" width="57%" align=left>
  		<p >2008StEnglishFinal</p>

		<td border="1" width="17%" align=center>
  		<p >09/08</p>

		<td border="1" width="18%" align=center>
  		<p ><b>&nbsp;</b></p>

This is the code i'm using to read from the form and write it to an array.



		If Request.Form("multiplebutton") = "Download SA8000" Then
            If Not (Request.Form("multiple11") Is Nothing) Then
                chkbox.Text = Request.Form("multiple11")
            End If
        End If		
        For Each s As String In Split(chkbox.Text, ",")

        Dim archiveName As String = String.Format("archive-{0}.zip", DateTime.Now.ToString("yyyy-MMM-dd-HHmmss"))
        Response.ContentType = "application/zip"
        Response.AddHeader("content-disposition", "filename=" + archiveName)
        Using zip As New ZipFile()
        zip.AddFiles(vectorfic, "")
        End Using


This is what WinRar is showing when I download the zip file.

!   C:\Documents and Settings\rui.matos\Local Settings\Temporary Internet Files\Content.IE5\LR1BQOGT\archive-2010-Abr-12-161526[1].zip: Unexpected end of archive


Funny thing is that if I add one more file to the list, it errors, if I remove one, everything works.


Any idea if there is a limit?

This is making no sense to me.


EDIT: just noticed that if I remove one entry from the html list, hence listing 89 checkboxes, I can zip 4 files. If I try to zip 5 files, it gets corrupted. If i remove another checkbox, I can add 9 files!! This is so weird.


Apr 12, 2010 at 6:43 PM
Edited Apr 12, 2010 at 6:55 PM

I'm betting that there's html content that is dribbling into your Response.OutputStream, either before or after you write the zip file to it. 
It seems random because the number of checkboxes affects the stream state.

If I'm right, then you need to call Response.End() after the "End Using". 
If not Response.End, then some other way to close the Response, like HttpApplication.EndRequest(). 



Apr 13, 2010 at 9:34 AM

guess what?

response.end() seemed to solve it


many thanks Cheeso.