Is there a maximum size for a value in a block? When I used my
multipart/form-data routine to upload images to my web server for display,
my routine seems to choke on images over 8KB.  Here is my routine again for
reference.

-Ryan

#!rebol -cs

REBOL []

print "Content-Type: text/html^/"  ;-- Required Page Header

content-length: 20 + load system/options/cgi/content-length
post-data: make string! content-length
read-io system/ports/input post-data content-length

write %post-data dehex post-data ; ## DEBUG
print "successful write" ; ## DEBUG

post-data: make binary! post-data

parse/all post-data [to "----" copy text thru "^/" (boundary: copy text)]

cd-block: []
parse/all post-data [
    any [thru boundary copy text [to boundary | to end] (text: make binary!
text append cd-block text)]]

cd-input: []
foreach cd cd-block [
    either find cd "filename" [
        parse/all cd [thru {name="} copy text to {"} (append cd-input
text)]
        parse/all cd [thru {filename="} copy text to {"} (file-path-string:
copy text)]
        file-path-block: parse/all file-path-string {\/"}
        filename: last file-path-block
        parse/all cd [thru {Content-Type: } copy text to {^M^/}
(file-mime-type: copy text)]
        ; parse/all cd [thru {^M^/^M^/} copy text to {^M^/} (text: make
binary! text append cd-input text)]
         parse/all cd [thru {^M^/^M^/} copy text [to boundary | to end]
(text: make binary! text append cd-input text)]
    ][
    parse/all cd [thru {name="} copy text to {"} (append cd-input text)]
    parse/all cd [thru {^M^/^M^/} copy text to {^M^/} (append cd-input
text)]
    ]
]

foreach item cd-input [print rejoin [newline item newline newline]] ; ##
DEBUG

cd-input: head cd-input
object-data: make object! []

for x 1 (length? cd-input) 2 [
    variable: first cd-input
    cd-input: next cd-input
    value: first cd-input
    either binary? value [
        make-object-data: reform [rejoin [{object-data: make object-data [}
(variable) {: } (value) {]}]]
    ][
        make-object-data: reform [rejoin [{object-data: make object-data [}
(variable) {: ^{} (value) {^}]}]]
    ]
    do make-object-data
    cd-input: next cd-input
]

make-object-data: reform [rejoin [{object-data: make object-data [filename:
^{} (filename) {^}]}]]
do make-object-data

make-object-data: reform [rejoin [{object-data: make object-data
[file-mime-type: ^{} (file-mime-type) {^}]}]]
do make-object-data

image-name: make file! (rejoin [{../images/} object-data/filename])
write/binary image-name object-data/file
wait 4
print rejoin [{<IMG SRC="} image-name {">}]

Ryan C. Christiansen
Web Developer

Intellisol International
4733 Amber Valley Parkway
Fargo, ND 58104
701-235-3390 ext. 6671
FAX: 701-235-9940
http://www.intellisol.com

Global Leader in People Performance Software

_____________________________________

Confidentiality Notice
This message may contain privileged and confidential information. If you
think, for any reason, that this message may have been addressed to you in
error, you must not disseminate, copy or take any action in reliance on it,
and we would ask you to notify us immediately by return email to
[EMAIL PROTECTED]

-- 
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the 
subject, without the quotes.

Reply via email to