upload image.jpg en rebol3, formulaire cgi méthode post
Bonjour, je cherche un moyen pour 'uploader' une image jpg en rebol3 avec un formulaire cgi méthode post. Cela fait 3 jours que je travaille dessus sans succès donc je suis preneur de toutes les idées que vous pourriez avoir. Merci par avance et bon dev.
posted by: rosanoff 28-Nov-2015/23:53:48-8:00
I think Bo got it working here: http://video.respectech.com:8080/jsid/cgi.r
posted by: Nick 29-Nov-2015/19:45:14-8:00
Merci je regarde ce soir. Cordialement
posted by: rosanoff 29-Nov-2015/23:09:41-8:00
Hello, it almost works . My original image weighs 13.2ko and upload my picture is cut and weighs 1.26ko . how to have the whole ? thanks in advance.
posted by: rosanoff 30-Nov-2015/13:01:33-8:00
Can you post your HTML and the complete CGI script (or at least the relevant portions)? What version of R3 are you using, server OS, etc?
posted by: Nick 2-Dec-2015/3:47:10-8:00
bonjour, je travail sous debian8 64b serveur thttpd mon code : #!/etc/r3 -cs R E B O L [title: "CGI GET vs POST"] handle-get: funct [] [ prin [ "Content-type: text/html" crlf crlf "Rebol 3 CGI Sample: Form" ] ] handle-post: funct [] [ ; data: to string! read system/ports/input ; fields: parse data "&=" ; value: dehex select fields "field" ;value: replace/all value "+" " " prin [ "Content-type: text/html" crlf crlf "Rebol 3 CGI Sample: Response" ; "Hello," (join value "!") ] ; debut test data: to binary! read system/ports/input load-multipart: func [ data [binary!] /local store name content filetype filename file-prototype qchars nchars dchars ][ boundary: copy/part data find data #{0D0A} store: context [] file-prototype: context [name: data: type: meta: #[none]] qchars: #[bitset! 64#{//////v///////////////////////////////////8=}] nchars: #[bitset! 64#{//////////f///////////////////////////////8=}] crlf: #{0D0A} ;probe to-string data unless parse data [ some [ [ ;(probe 0) boundary crlf ;(probe 1) (name: content: filemime: filetype: filename: none) ;(probe 2) {Content-Disposition: form-data; name=} ;(probe 3) {"} copy name to {"} {"} ;(probe 4) opt [ {; filename=} [ {"} copy filename to {"} {"} thru crlf ;(probe to-string filename) thru {Content-Type: } copy filetype to crlf ;(probe to-string filetype) ] ] ;(probe 5) crlf crlf [copy content to boundary | copy content to end] ;(probe content) ;(probe 6) ( if crlf = skip tail content -2 [ clear skip tail content -2 ] if all [ filename not empty? filename ][ write join %/var/www/ad/img/ to-string filename content content: filename ] store: make store compose [ (to-set-word to-string name) (to-string content) ] ) ] | [boundary "--" to end] ;(probe 99) ] ][ print "Invalid Multipart Postdata" ] store ] load-multipart data ; fin test ] switch get-env "REQUEST_METHOD" [ "GET" [handle-get] "POST" [handle-post] ] je ne comprend pas ce qui ne va pas. merci par avance.
posted by: rosanoff 2-Dec-2015/12:28:04-8:00
|