Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Problem - 4096 byte limit on POST from browser

From: rebol665::ifrance::com at: 3-Jun-2002 9:08

Hi Andrew The 4096 limit may be caused by the encoding method. I suggest you use the multipart/form-data. I have been able to transfer 500 Ko file without problem with it. <FORM NAME="formulaire" METHOD="POST" ENCTYPE="multipart/form-data" ACTION="http://localhost/cgi-bin/uploader.r"> Reading such encoding is a little more complex. Here is a piece of code I was working with some times ago. It is not complete, but it may help you see if data are sent correctly. I am not able to test it now because of my "I-want-to-start-a-new-life-with Linux" situation. You will have to change the first line and to create a download directory in your cgi-bin directory. 8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #! d:/rebview/rebol.exe -cs REBOL [] print "Content-Type: text/html^/^/" query-length: to-integer system/options/cgi/content-length data: make binary! #{} until [ buffer: make binary! #{} read-io system/ports/input buffer query-length append data buffer ((length? data) = query-length ) ] write/binary %./download/upload.bin data parse-data: func [/talk][ ; ; parsing the cgi data ; ; data are separated by a two characters end-of-line (eol) eol: #{0D0A} ; text-boundary is often augmented with leading "-" characters separator: to-string copy/part data find data eol if talk [print [ <PRE> "separator: " separator </PRE>]] ; text-boundary + eol is used as a separator separator: join separator eol item: "" cpt-length: 0 if parse data [ thru separator some [ copy item thru separator (cpt-length: cpt-length + length? item) (item: copy/part item find item separator) (print [ <PRE> item </PRE> <BR> cpt-length <BR>]) ] copy item thru text-boundary (cpt-length: cpt-length + length? item) (print [ <PRE> item </PRE> <BR> cpt-length <BR>]) 4 skip (cpt-length: cpt-length + 4) (print [<BR> cpt-length <BR>]) ][ print [ <H2> "data parsing correct !" </H2>]] ;---------------------------7d2334b888 ] ; multipart/form-data? ; Content-Type: {multipart/form-data; boundary=---------------------------7d2324888} parse system/options/cgi/content-type [ copy data-type to ";" skip thru "=" copy text-boundary to end ] print [ <HTML> <BODY> <H1> "Rebol Uploader" </H1> <H2> "POST method" </H2> <PRE> "Content-length : " query-length </PRE> <PRE> "Length data : " length? data </PRE> <PRE> "data-type : " data-type </PRE> <PRE> "text-boundary : " text-boundary " = " length? text-boundary </PRE> <HR> ] parse-data/talk print [ <HR> <PRE> mold system/options/cgi </PRE> </BODY> </HTML> ] 8<- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HTH Patrick