cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to send a form field value that begins with '@'?

From: david houlder <david.houlder_at_anu.edu.au>
Date: Fri, 04 Mar 2005 21:15:29 +1100

David Houlder wrote:

>
> e.g.
> curl --form --literal foo1=$bar1 --literal foo2=$bar2 \
> --file foo3contents=$foofile http://somewhere.org

OK, I've just read the man page again and realised that the correct
usage of --form is actually
curl --form name=value --form name=value ... url
and not
curl --form name=value name=value ... url
as I was assuming.

> > For backward-compatibility I think about a new flag like this:
> >
> > curl --form-string name=@string http://somewhere.org
> > curl --form-file name=filename http://somewhere.org

Yep, sounds ideal, now that I have RTFM properly. Presumably --form-file
would trigger the multipart/form-data upload just like
  --form name=@file does?

Note that there might be cases where you want to upload from a file but
keep it as application/x-www-form-urlencoded (e.g. tiny files), so maybe
there could also be another option, maybe --form-file-urlencoded. Not a
priority in my book though.

Cheers
David.
Received on 2005-03-04