Using regular routines/script huge data cannot be proceced over ASP Form. The ASP limit for FORM data (Request.Form) is about 102,399 bytes (according to Microsoft). If limit exeeds ASP page will raise the error
Q273482, PRB: Request object, ASP 0107 (0x80004005)
.The best solution to handle more than specified limit is using Binary data in x-www-form-urlencoded forms or you can use Huge asp file upload.ASPForm to handle POST requests. Huge asp file upload.ASPForm contains hi-performance, low resources consumption algorithm which can accept up to 2GB of data with multipart (upload) or x-www-form-urlencoded forms.
We can build our own function, which will read binary data from input (x-www-form-urlencoded data) and then we can split the data to fields and decode to text fields. This article contains ASP include, which does the form processing and decoding. You can use it by the next way:
Thanks to Antonin Foller, PSTRUH Software, http://www.motobit.com
HTML file, index.htm
<!--#INCLUDE FILE="process.asp"--> <Form Method=Post> <Input Name=TestField><br> <textarea Name=Text ROWS=30 COLS=100>Some laaaarge data</textarea> <br> <Input type=Submit> </Form>
Put following asp code in
index.asp
Dim FormFields Set FormFields = GetForm Dim Field For Each Field In FormFields Response.Write "" & Field & ":" & Len(FormFields(Field)) Next
Now make included ASP page - process.asp
Function GetForm Dim FormFields Set FormFields = GetForm Dim Field For Each Field In FormFields Response.Write "0 And _ Request.ServerVariables("HTTP_CONTENT_TYPE") = "application/x-www-form-urlencoded" Then Dim SourceData SourceData = Request.BinaryRead(Request.Totalbytes) SourceData = RSBinaryToString(SourceData) SourceData = split(SourceData, "&") Dim Field, FieldName, FieldContents For Each Field In SourceData Field = split(Field, "=") FieldName = URLDecode(Field(0)) FieldContents = URLDecode(Field(1)) FormFields.Add FieldName, FieldContents Next end if'Request.Totalbytes>0 Set GetForm = FormFields End Function Function URLDecode(ByVal What) Dim Pos, pPos What = Replace(What, " ", " ") on error resume Next Dim Stream: Set Stream = CreateObject("ADODB.Stream") If err = 0 Then on error goto 0 Stream.Type = 2 'String Stream.Open Pos = InStr(1, What, "%XX pPos = 1 Do While Pos > 0 Stream.WriteText Mid(What, pPos, Pos - pPos) _ Chr(CLng("&H" & Mid(What, Pos 1, 2))) pPos = Pos 3 Pos = InStr(pPos, What, "%XX Loop Stream.WriteText Mid(What, pPos) Stream.Position = 0 URLDecode = Stream.ReadText Stream.Close Else on error goto 0 Pos = InStr(1, What, "%XX Do While Pos>0 What = Left(What, Pos-1) _ Chr(Clng("&H" & Mid(What, Pos 1, 2))) _ Mid(What, Pos 3) Pos = InStr(Pos 1, What, "%XX Loop URLDecode = What End If End Function Function RSBinaryToString(Binary) Dim RS, LBinary Const adLongVarChar = 201 Set RS = CreateObject("ADODB.Recordset") LBinary = LenB(Binary) If LBinary>0 Then RS.Fields.Append "mBinary", adLongVarChar, LBinary RS.Open RS.AddNew RS("mBinary").AppendChunk Binary RS.Update RSBinaryToString = RS("mBinary") Else RSBinaryToString = "" End If End Function
0 comments:
Post a Comment
comment or ask