cURL / Mailing Lists / curl-users / Single Mail

curl-users

7.9.4: multipart/form-data (-F) option syntax

From: kromJx <kromJx_at_myrealbox.com>
Date: Mon, 18 Feb 2002 16:59:30 +0000

I recently noticed the following inadequacy in the curl -F option syntax.

The choice of ':' as a delimiter for the file content type argument
         curl -F "coolfiles=@fil1.gif;type=image/gif"
is rather unfortunate, as it makes it difficult to set things like
         Content-Type: text/plain; charset=iso-8859-2

It would be nice if one left the ';type=foo' syntax as it is and
added an extra tag (headers) which works like this:
         curl -F "coolfiles=@fil1.txt;headers=@fil1.hdr"
where fil1.hdr contains extra headers like
        Content-Type: text/plain; charset=KOI8-R"
        Content-Transfer-Encoding: base64
        X-User-Comment: Please don't use browser specific HTML code
These headers would then override the program's reasonable defaults
(plain/text, 8bit...)

That is, let the user (who presumably knows what she is doing) compose
the file content (fil1.txt) and the associated headers (fil1.hdr). Without
any user hints, 'curl' will do its best (as it does now). If the user
insists on changing things, she is the one to worry about whether the
web server at the other end (recipient) barfs/complains.

What do you all think ? Does anyone else have a better/more elegant
suggestion ?

- J
Received on 2002-02-18