cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: problem with multipart/form-data

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Mon, 20 Jun 2005 20:45:14 +0200 (CEST)

On Mon, 20 Jun 2005, Daniel Fairchild wrote:

> I've been trying to get libcurl ( libcurl/7.13.1 ) to do my exact php (5.0.4
> ) bidding for a few days now, and its not working out for me. From the
> archives I can tell that others have had the same problem:
> http://curl.haxx.se/mail/lib-2003-09/0115.html

I'm confused. That URL refers to a moot problem, since the user used a bad
syntax to do what he wanted.

> Notice that even though no data was submitted to the input file field,
> there's still something about the file input in the http request.

I don't understand. What do you mean with this last line?

> Please note that I have no problems when actually supplying a file with
> libcurl,

So what _is_ the problem?

> ($post_data[FILE1] = "@pathtofile";) to the form on the server in question.

Now you talk PHP/CURL I presume?

> Maybe the functionality I'm suggesting is already present in cURL and it
> just boils down to me spending 3 days looking in all the wrong places, but
> I'd like to suggest the following to ensure better "likeness" to the way
> real web browsers submit multipart/form-data:

When you do what?

> When I'm setting up my post data array (to be submitted to libcurl with
> curl_setopt($ch, CURLOPT_POSTFIELDS, $postData );) I'd like to be able to
> add the result of empty html file forms to the http request.

You want to post an empty file? So what goes wrong if you do submit an empty
file? It seems to work fine when I try it.

> I'm thinking that maybe an entry like this:
> $post_data[FILE1] = "@";

Now you're talking PHP/CURL again. It could probably be made to support that
syntax, but you're talking to the wrong crowd if you want to discuss what
PHP/CURL should or should not do since we don't maintain nor deal with that
binding here. It is authored by the PHP team.

libcurl supports submitting an empty file.

-- 
  Commercial curl and libcurl Technical Support: http://haxx.se/curl.html
Received on 2005-06-20