Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - RTE 120kb+ submit problem
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Forum LockedRTE 120kb+ submit problem

 Post Reply Post Reply
Author
demods View Drop Down
Newbie
Newbie


Joined: 10 September 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote demods Quote  Post ReplyReply Direct Link To This Post Topic: RTE 120kb+ submit problem
    Posted: 10 September 2004 at 6:53am

I'm using RTE for a year and it's one of the best. But I have a problem that I couldn't solve yet. When you send data over 120kb (this makes to much but belive me, RTE generates too long code if you copy from a Word document), RTE gives error. I searched internet and I found that IE can't send data over 120kb. Then I found a function that gets data over 120kb. I wrote the function below. Instead of using Request.Form I use FormFields function to get form values.

But this function also has some disadvantages. If you Set this function and then try to use any Request object, you get an error

Set FormFields = GetForm
strForm = Request("frmAction")

This code gives the following error;

Cannot use Request.Form collection after calling BinaryRead

So here's my question; how can I prevent this error. How can I use Request.Form AFTER calling BinaryRead? I have to use Request after FormFields function.

Thanks.......

 

Function GetForm
  'Dictionary which will store source fields.
  Dim FormFields
  Set FormFields = CreateObject("Scripting.Dictionary")

  'If there are some POST source data
  If Request.Totalbytes>0 And _
    Request.ServerVariables("HTTP_CONTENT_TYPE") = _
    "application/x-www-form-urlencoded" Then

    'Read the data
    Dim SourceData
    SourceData = Request.BinaryRead(Request.Totalbytes)

    'Convert source binary data To a string
    SourceData = RSBinaryToString(SourceData)

    'Form fields are separated by "&"
    SourceData = split(SourceData, "&")
    Dim Field, FieldName, FieldContents
 
    For Each Field In SourceData
      'Field name And contents is separated by "="
      Field = split(Field, "=")
      FieldName = URLDecode(Field(0))
      FieldContents = URLDecode(Field(1))
      'Add field To the dictionary
      FormFields.Add FieldName, FieldContents
    Next
  end if'Request.Totalbytes>0
  Set GetForm = FormFields
End Function

Function URLDecode(ByVal What)
'URL decode Function
'2001 Antonin Foller, PSTRUH Software,
http://www.motobit.com
  Dim Pos, pPos

  'replace + To Space
  What = Replace(What, "+", " ")

  on error resume Next
  Dim Stream: Set Stream = CreateObject("ADODB.Stream")
  If err = 0 Then 'URLDecode using ADODB.Stream, If possible
    on error goto 0
    Stream.Type = 2 'String
    Stream.Open

    'replace all %XX To character
    Pos = InStr(1, What, "%")
    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, "%")
    Loop
    Stream.WriteText Mid(What, pPos)

    'Read the text stream
    Stream.Position = 0
    URLDecode = Stream.ReadText

    'Free resources
    Stream.Close
  Else 'URL decode using string concentation
    on error goto 0
    'UfUf, this is a little slow method.
    'Do Not use it For data length over 100k
    Pos = InStr(1, What, "%")
    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, "%")
    Loop
    URLDecode = What
  End If
End Function


Function RSBinaryToString(Binary)
  'Antonin Foller,
http://www.motobit.com
  'RSBinaryToString converts binary data (VT_UI1 | VT_ARRAY)
  'to a string (BSTR) using ADO recordset
 
  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

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2004 at 8:44am
I looked into this some time ago and the simple anwser is that you can't.

All form fields would need to be parsed in someway to get the data from them.
Back to Top
demods View Drop Down
Newbie
Newbie


Joined: 10 September 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote demods Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2004 at 9:09am

But this forum also has the "120+kb" bug (I call it a bug because there exists a solution), which uses RTE1.2c. So, do you plan to fix RTE1.2c or continue with this bug. I ask this because if you try to fix RTE, you will probably face the same problem that I have. And if you find a solution, that would be great.

I thought another way, storing datas in session and then redirecting to form process page, but this is a loss of time. I will try to find some solution for this problem. I think this is a serious problem in ASP.

Anyway, thank you for your fast reply.

Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2004 at 9:51am
I spent the best prt of a week looking into this before and could not come up with a solution.
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 10 September 2004 at 11:47am

Have you taken a look at using the html filter for Word add-on. They have one for every version that cleans up the code quite a bit - http://www.microsoft.com/downloads/details.aspx?FamilyID=209 ADBEE-3FBD-482C-83B0-96FB79B74DED&displaylang=en

 


Lead me not into temptation... I know the short cut, follow me.
Back to Top
demods View Drop Down
Newbie
Newbie


Joined: 10 September 2004
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote demods Quote  Post ReplyReply Direct Link To This Post Posted: 14 September 2004 at 4:05am
Originally posted by dpyers dpyers wrote:

Have you taken a look at using the html filter for Word add-on. They have one for every version that cleans up the code quite a bit - http://www.microsoft.com/downloads/details.aspx?FamilyID=209 ADBEE-3FBD-482C-83B0-96FB79B74DED&displaylang=en

Thank for the link. I downloaded the app and it's only for Office 2000. But I need a 2003 version. I think there is no 2003 version yet. But thanks anyway. I will try to find a 2000 version and try this application. I hope 2003 comes out soon.

Thank you...

Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post Posted: 14 September 2004 at 8:22am

I use office 2K3. They embedded it in the Save As dialog. Now there's a "Save As Web Document (html)" and a "Save as Filtered Web Document (html)".

They both save as html, but the Filtered version removes a lot (but not all) of the mso crap.


Lead me not into temptation... I know the short cut, follow me.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.