cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Posting the content of a file on Windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 21 Feb 2007 15:04:21 +0100 (CET)

On Wed, 21 Feb 2007, Laurent wrote:

> curl -d "user=xxxx" -d "aud=base64encodedata" http://www.url.com
>
> which works fine as long as the audio data is very small. If I try with a
> file of say 10KB I get this error: "The input line is too long."

You can circumvent that limit by adding these options in a "config file" and
point to it with -K.

> Now I tried to get curl to read the data from a file and send it as a
> string. From the manual I understand the syntax should be:
>
> curl -d "user=xxxx" -d "aud=<myEncodedFile.b64" http://www.url.com

Nope. That's not a valid curl syntax for reading from a file.

> I also tried different alternatives such as:
>
> curl -d "user=xxxx" -d "aud=@myEncodedFile.b64" http://www.url.com

Now you're closer, but it should be:

   curl -d "user=xxxx" -d @myEncodedFile.b64 http://www.url.com

(note that you then need to deal with the "aud=" part within the file)

> curl -F "user=xxxx" -F "aud=<myEncodedFile.b64" http://www.url.com

This works, but makes a multipart formpost and since you want -d, -F can't be
right

> curl -F "user=xxxx" -F "aud=@myEncodedFile.b64" http://www.url.com

This too works, but has the same -F while -d is what you want.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2007-02-21