cURL / Mailing Lists / curl-users / Single Mail


Re: HTTP- post question...

From: Daniel Stenberg <>
Date: Mon, 10 Nov 2003 08:28:42 +0100 (CET)

On Sat, 8 Nov 2003, Cyntech Solutions wrote:

> Trying to simulate filling out this form
>, the following I
> know to be true:
> 1 of the form fields is a file curl needs to follow redirects curl needs to
> specify the referer as
> The file 1.jpg
> exists in the current directory

I can recommend using the 'formfind' script to extract the necessary details.

> (The post data below is just sample data(ie. user=foobar, etc. ) to make for
> a shorter email to this list.)
> Reading the manual I assume it should look something like:
> curl -L -e -F
> "userfile=@1.jpg" -F "user=foobar&pass=12345&id=blablabla&ding=submit"

When you use -F, you should provide one "part" with each -F. So if you want to
send away parts named "user", "pass" and "id", you'd do it:

 -F user=foobar -F pass=12345 -F id=blalblabla

The &-separated blob shown above is when you do "normal" posts, as made with
curl -d.

> Am I doing it right? Assuming that I send all of the correct post data,
> shouldn't this work?

Possibly, unless the server does some more tricks. Like using cookies.

> The form keeps redisplaying instead of giving me the success screen.

If you correct the -F usage, you might reach further.

    Daniel Stenberg -- --
 [[ Do not post private mails to this email address. They won't reach me. ]]
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more!
Received on 2003-11-10