Domanda

I am maintaining a site that uses a HTML editor with an image upload feature. When you click upload it opens a popup that lists a path to every image in the folder. There are currently more than 7000 images in the folder.

The code is quite messy. It uses the Scripting.FileSystemObject to get an array of the files and then loops using a for each statement.A response.write is used to display each file's info and for some reason an issue is occurring if there's more than 4015 images in the folder. No error is occurring as such but it seems the function writing out the files just fails silently and the page stops rendering.

I am confused why it works when there's less than 4015 files. Could it be a memory issue ? I was expecting to receive an error of some sort.

Thanks for any info.

Below is the Response.Write being used for each file

            Response.Write "<tr style='background:" & sColorResult & "'>" & VbCrLf & _
            "<td><img src='images/"&sIcon&"'></td>" & VbCrLf & _
            "<td valign=top width=100% ><u id=""idFile"&nIndex&""" style='cursor:pointer;' onclick=""selectFile(" & nIndex & ")"">" & oFile.name & "</u>&nbsp;&nbsp;<img style='cursor:pointer;' onclick=""downloadFile(" & nIndex & ")"" src='download.gif'></td>" & VbCrLf & _

            "<td valign=top align=right nowrap>" & FormatNumber(oFile.size/1000,1) & " kb&nbsp;</td>" & VbCrLf & _          
            "<td valign=top nowrap onclick=""deleteFile(" & nIndex & ")""><u style='font-size:10px;cursor:pointer;color:crimson' " & sFolderAdmin & ">" & VbCrLf

        if not bWriteFolderAdmin then
            Response.Write "<script>document.write(getTxt('del'))</script>" & VbCrLf
        end if

        Response.Write "</u></td></tr>" & VbCrLf
È stato utile?

Soluzione

Sounds like the issue here was the response buffer filling up. Either of these solutions should work:

  1. Disable buffering by adding Response.Buffer = False as the first line of code.
  2. Leave buffering enabled but call Response.Flush() at certain intervals to flush the buffer.
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top