[Haskell] Network.CGI: <INPUT TYPE="file">?

Johannes Waldmann waldmann at imn.htwk-leipzig.de
Tue Nov 30 03:21:36 EST 2004


I am using Network.CGI (with ghc-6.2)
How can I use an <INPUT TYPE="file"> element?

I guess I know how to produce one:

  Text.Html.input
             ! [ Text.Html.name    tag
	      , Text.Html.thetype "file"
	      , Text.Html.intAttr "maxlength" 10000
	      , Text.Html.strAttr "accept"    "text/*"
	      ]

But to get to the file contents, it seems I should add

   Text.Html.strAttr "enctype" "multipart/form-data"

to the <FORM> element, where I already have

   Text.Html.method "POST"

but then I can't ready any values out of the environment
that is provided by Network.CGI.wrapper.
The environment then contains

, ( "QUERY_STRING", "" ), ( "CONTENT_LENGTH", "1590" )
, ( "CONTENT_TYPE"
   , "multipart/form-data; 
boundary=---------------------------1409895718904..."
   )

Am I doing something wrong, HTML-wise
(is it allowed to mix TYPE="file" input with other input elements
in one FORM?) or is this a problem with the library?

Any help appreciated.
-- 
-- Johannes Waldmann,  Tel/Fax: (0341) 3076 6479 / 6480 --
------ http://www.imn.htwk-leipzig.de/~waldmann/ ---------



More information about the Haskell mailing list