From: Anders N. <an...@di...> - 2001-01-26 13:11:07
|
Hi. I'm trying to implement a file uploadpage with cgi. I've taken a look at the demo that comes with the tclhttpd, especially the testupload.tml file. For me, since I don't really get the .tml workings, the main part of recieving the uploaded file is this: foreach {n v} [ncgi::nvlist] { append html [html::row $n [html::tableFromList [lindex $v 0]]] append html [html::row $n [ncgi::value $n]] append html <tr>[html::cell "colspan=2" "<pre>[html::quoteFormValue [lindex $v 1]]</pre>"]</tr> } which nicely breaks down to: foreach {n v} [ncgi::nvlist] { append html "name: $n " append html "value: $v " } for the sake of clarity. Now, that works just fine, but when I try to put that into my own ncgitest.cgi file, it doesn't work as in the .tml file above. When I run my own cgi-script, I don't get any values in the $n variable, and in the $v variable I get the whole thing. Ie. the .tml file gives these values: $n: hide_me $v: {content-disposition form-data name hide_me} {hello, world} while my cgi-file gives these values: $n: <empty> $v: {} {Content-Disposition: form-data; name="hide_me" hello, world } Also, when I try to upload a little bigger imagefile the .tml version handles it nicely, but my cgi-file just hangs... What am I doing wrong, or what is the .tml version doing that I don't? /Anders N |