When the amount of data sent by the form is large, an error will be reported. Checking MSDN, we learned that the reason is that Microsoft has a limit on the maximum data that can be received using Request.Form(). It is 80K bytes in IIS4 and 100K bytes in IIS5.
The following are several solutions provided by Microsoft:
1. Use Request.BinaryRead instead of Request.Form method to parse form data;
2. Use a file upload solution, such as Microsoft Posting Acceptor;
3. Since the 102399 byte limit is for each form elements, so when submitting, separate the form element content greater than 102399 into multiple form elements for submission.
The following is sample code: (Microsoft reminds: The following code may not be fully applicable to specific needs, and is not responsible for the consequences of using these codes!)
<FORM method=post action=LargePost.asp name=theForm onsubmit="BreakItUp()">
<Textarea rows=3 cols=100 name=BigTextArea>A bunch of text...</Textarea>
<input type=submit value=go>
</form>
<SCRIPT Language=JavaScript>
function BreakItUp()
{
//Set the limit for field size.
//If the content has Chinese characters, it can be set to: 51100
var FormLimit = 102399
//Get the value of the large input object.
var TempVar = new String
TempVar = document.theForm.BigTextArea.value
//If the length of the object is greater than the limit, break it
//into multiple objects.
if (TempVar.length > FormLimit)
{
document.theForm.BigTextArea.value = TempVar.substr(0, FormLimit)
TempVar = TempVar.substr(FormLimit)
while (TempVar. length > 0)
{
var objTEXTAREA = document.createElement("TEXTAREA")
objTEXTAREA.name = "BigTextArea"
objTEXTAREA.value = TempVar.substr(0, FormLimit)
document.theForm.appendChild(objTEXTAREA)
TempVar = TempVar.substr(FormLimit)
}
}
}
</SCRIPT>
Main code for accepting data page:
<%
Dim BigTextArea
For I = 1 To Request.Form("BigTextArea").Count
BigTextArea = BigTextArea & Request.Form("BigTextArea")(I)
Next
%>