[Haskell-cafe] file upload with Network.CGI

Glynn Clements glynn.clements at virgin.net
Thu Aug 26 16:44:16 EDT 2004

Peter Simons wrote:

> Has anyone managed to process the results of a "file upload"
> formular, such as
>   <form action="input_file.htm" enctype="multipart/form-data">
>   <p>Choose a file: <input name="foobar" type="file" size="50"
>                            maxlength="100000" accept="text/*">
>   </p>
>   </form>
> ..., with Network.CGI successfully? I have tried it, but it
> appears that the library can't handle the "multipart/form-data"
> encoding -- is that possible?

Given that most of the CGI library is essentially a decoder for
application/x-www-form-urlencoded data, it isn't much use if you
aren't actually processing such data.

About the only functions in Network.CGI which might be useful for
processing file uploads are getQueryString and getCgiVars, neither of
which are exported.

This seems to be a common problem with Haskell libraries, i.e. define
lots of useful low-level functions, use them to create a high-level
interface (which typically isn't as useful as the author assumes),
then only export the high-level interface.

Glynn Clements <glynn.clements at virgin.net>

More information about the Haskell-Cafe mailing list