The solution is to split the data in a field that needs to send big data into smaller than the quota before submitting the form, and put the data in several hidden domains respectively, at the same time, empty the original domain and then formally submit the form. The server still uses request. Form () to read data from various den domains, and then concatenates them in order. Main
Code As follows:
Note: You must specify a DIV in the HTML code of form to dynamically Insert the hidden field to it.
==== Client sample code ====
Add <Div id = divhidden> </div> to the HTML code of form, and add onsubmit = "Return fnprehandle (this)" to the form tag )", replace bigfield in the following code with the name of the field in the big database submitted in your form.
JavaScript codeCopy codeThe Code is as follows: <script language = JavaScript>
// Split the data and place it in the corresponding hidden domain.
Function fnprehandle (myform)
{
VaR icount; // The number of fields to be split.
VaR strdata; // raw data
VaR imaxchars = 50000; // considering that the Chinese character is double byte, the maximum number of characters in the domain is 50 K.
VaR ibottleneck = 2000000; // IfArticleMore than 2 m characters, prompt the user
VaR strhtml;
// Raw data
Strdata = myform. bigfield. value;
// If the article is too long, remind the user
If (strdata. length> ibottleneck)
{
If (confirm ("the article you want to publish is too long. We recommend that you split it into several parts for release. \ N if you insist on submission, note that it takes a long time to submit successfully. \ N do you insist on submitting? ") = False)
Return false;
}
Icount = parseint (strdata. Length/imaxchars) + 1;
// Hdncount records the number of subdomains in the original data domain
Strhtml = "<input type = hidden name = hdncount value =" + icount + "> ";
// Generate HTML code for each subdomain
For (VAR I = 1; I <= icount; I ++)
{
Strhtml = strhtml + "\ n" + "<input type = hidden name = hdnbigfield" + I + "> ";
}
// Dynamically Insert the HTML code of each den field in the form Div (divhidden)
Document. All. divhidden. innerhtml = strhtml;
// Assign values to each subdomain
For (VAR I = 1; I <= icount; I ++)
{
Myform. elements ["hdnbigfield" + I]. value = strdata. substring (I-1) * imaxchars, I * imaxchars );
}
// Clear the original data domain
Myform. bigfield. value = "";
}
</SCRIPT>
Server Sample Code ASP/Visual Basic CodeCopy codeThe Code is as follows: <%
Dim strdata
Dim intfieldcount
Dim I
Intfieldcount = request. Form ("hdncount ")
For I = 1 to intfieldcount
Strdata = strdata & request. Form ("hdnbigfield" & I)
Next
Response. Write strdata
%>