Microsoft recommends using () to read form data, but since this method reads binary data, it is necessary to analyze the read data byte by byte to generate meaningful strings (this is how a program on MSDN is written, but it does not consider that escaped characters such as punctuation marks need special analysis). If this method is barely available for pure English systems, it will be extremely troublesome for Chinese systems, because Chinese characters are represented by two bytes, and the read binary data itself cannot determine whether it is English or Chinese characters (otherwise it is not binary data, but a string ^-^). In this way, you must understand the coding rules of Chinese characters before you can analyze them. Finally, even if all these can be analyzed algorithmically, think about how effective it is to analyze a giant MB-level string byte byte? So, this road is not open!
However, there are always ways. At first I thought the total of the entire form data could not exceed 100KB, but later I found that this was a limit on each domain in the form. The solution to the problem is that for a domain that needs to send big data, the data is split into several copies smaller than the limit before submitting the form, and placed them in several hidden fields, and the original domain is cleared and the form is officially submitted. The server side still uses () to read the data of each hidden domain and then splice them in order. The main code is as follows:
Note: You need to specify a DIV in the HTML code in Form to dynamically insert the hidden domain into it.
====Client sample code====
<SCRIPT language=javascript>
//Split the data and put it in the corresponding hidden domain to fire in the onSubmit event of Form
function fnPreHandle()
{
var iCount; //How many domains are split into
var strData; //Raw data
var iMaxChars = 50000;// Considering that Chinese characters are double bytes, the maximum number of characters in the field is limited to 50K
var iBottleNeck = 2000000;//If the article exceeds 2M words, the user needs to be prompted
var strHTML;//Raw data
strData = ;//If the article is too long, you need to remind the user
if ( > iBottleNeck)
{
if (confirm("The article you want to publish is too long, it is recommended that you split it into several parts and publish it separately.\nIf you insist on submitting, please note that it will take a long time to submit it successfully.\n\nDo you insist on submitting it?") == false)
return false;
}iCount = parseInt(/iMaxChars) + 1;//hdnCount records how many subdomains the original data domain is split into
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 HTML code of each hidden domain in DIV (divHidden) in Form
= strHTML;// Assign values to each subdomain
for (var i = 1; i <= iCount; i++)
{
["hdnBigField" + i].value = ((i - 1) * iMaxChars, i * iMaxChars);
}//The original data domain is cleared
= "";
}
</SCRIPT>
====Server side sample code====
<%
Dim strData
Dim intFieldCount
Dim iintFieldCount = ("hdnCount")For i=1 To intFieldCount
strData = strData & ("hdnBigfield" & i)
strData
%>
However, there are always ways. At first I thought the total of the entire form data could not exceed 100KB, but later I found that this was a limit on each domain in the form. The solution to the problem is that for a domain that needs to send big data, the data is split into several copies smaller than the limit before submitting the form, and placed them in several hidden fields, and the original domain is cleared and the form is officially submitted. The server side still uses () to read the data of each hidden domain and then splice them in order. The main code is as follows:
Note: You need to specify a DIV in the HTML code in Form to dynamically insert the hidden domain into it.
====Client sample code====
Copy the codeThe code is as follows:
<SCRIPT language=javascript>
//Split the data and put it in the corresponding hidden domain to fire in the onSubmit event of Form
function fnPreHandle()
{
var iCount; //How many domains are split into
var strData; //Raw data
var iMaxChars = 50000;// Considering that Chinese characters are double bytes, the maximum number of characters in the field is limited to 50K
var iBottleNeck = 2000000;//If the article exceeds 2M words, the user needs to be prompted
var strHTML;//Raw data
strData = ;//If the article is too long, you need to remind the user
if ( > iBottleNeck)
{
if (confirm("The article you want to publish is too long, it is recommended that you split it into several parts and publish it separately.\nIf you insist on submitting, please note that it will take a long time to submit it successfully.\n\nDo you insist on submitting it?") == false)
return false;
}iCount = parseInt(/iMaxChars) + 1;//hdnCount records how many subdomains the original data domain is split into
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 HTML code of each hidden domain in DIV (divHidden) in Form
= strHTML;// Assign values to each subdomain
for (var i = 1; i <= iCount; i++)
{
["hdnBigField" + i].value = ((i - 1) * iMaxChars, i * iMaxChars);
}//The original data domain is cleared
= "";
}
</SCRIPT>
====Server side sample code====
Copy the codeThe code is as follows:
<%
Dim strData
Dim intFieldCount
Dim iintFieldCount = ("hdnCount")For i=1 To intFieldCount
strData = strData & ("hdnBigfield" & i)
strData
%>