[REBOL] REBOL chokes on POST data
From: ryan::christiansen::intellisol::com at: 26-Apr-2001 12:26
The following script is choking on my POST data. Specifically , it chokes
on the image file included in the data. What should I do next? I get the
following error...
** Syntax Error: Invalid string -- {ÿØÿà
** Near: (line 1) object-data: make object-data [file: {ÿØÿà
>>
REBOL won't parse the image data, but I have tried dumping the POST data
using both write and write/binary, with no success. Suggestions?
You can access my POST data file here...
http://www.fargonews.com/post-data
REBOL []
post-data: read %post-data
cd-block: []
parse/all post-data [
any [to "Content-Disposition:" copy text to "------" (append cd-block
text)]
]
cd-input: []
foreach cd cd-block [
parse/all cd [thru {name="} copy text to {"} (append cd-input text)]
if find cd "filename" [
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 {^/}
(file-mime-type: copy text)]
]
parse/all cd [thru {^/^/} copy text to {^/} (append cd-input text)]
]
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
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
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
[ryan--christiansen--intellisol--com]