MySQL Questions/answers - please post again
[1/3] from: jean:holzammer:faedv-n:bayern at: 23-May-2001 10:46
Hi,
Last week I posted some questions to this list. But as I was automatically
unsubscribed cause of some of my mails beeing bounced, I don't know if there
were any replies. If yes, would you please post your answers again ? (The
mailing list archive is not up to date. )
Thanks,
Jean
[2/3] from: m:koopmans2:chello:nl at: 23-May-2001 11:06
Jean,
>From the looks of it you use the MySQL lib from DocKimbel.
Have you tried the Mysql c lib mapping on erebol.com ? You need /Pro or
/Command for this to work though.
--Maarten
[3/3] from: gjones05::mail::orion::org at: 23-May-2001 6:01
From: "Holzammer, Jean"
<snip>
> Last week I posted some questions to this list. But as I was
automatically
> unsubscribed cause of some of my mails beeing bounced, I don't know if
there
> were any replies. If yes, would you please post your answers again ?
(The
> mailing list archive is not up to date. )
<snip>
Hi, Jean,
Ryan Christiansen also posted the following.:
--Scott Jones
**************
To upload a file to your server using an HTML form, use the following
two
functions in your receiving CGI script. The usage in your script is as
follows...
cgi-input: retrieve-user-data
That's it. Then you will have the contents of a POST or GET operation in
a
REBOL object! If POST input was sent using an HTML form using
enctype=multipart/form-data, the object will include the variables
filename
(the name of the uploaded file), file-mime-type (the mime type of the
uploaded file) and file (the file itself in binary.)
-Ryan
decode-multipart: make object! [
form-data: func [
][
post-data: make string! 100000
while [0 < read-io system/ports/input post-data 100000] []
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)]
]
]
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
object-data
]
]
retrieve-user-data: func [][
either system/options/cgi/request-method = "POST" [
content-type: system/options/cgi/content-type
content-type-elements: parse content-type none
enctype: content-type-elements/1
either enctype = "multipart/form-data" [
decode-multipart/form-data
][
post-data: make string! 100000
while [0 < read-io system/ports/input post-data 100000] []
return make object! decode-cgi post-data
]
][
return make object! decode-cgi system/options/cgi/query-string
]
]