cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: problem with multipart/form-data

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Tue, 21 Jun 2005 00:40:57 +0200 (CEST)

On Tue, 21 Jun 2005, Daniel Fairchild wrote:

> The entry would have been near identical except from the "hello world" part
> if the file had been empty. As you state libcurl supports both empty and
> non-empty files submission very well.

> What I don't think it supports is the http request entry for a <input
> type=file > element that was left "empty" (not pointing to a file in the
> local file system).

Correct, it assumes that you point out an existing file.

> When I don't supply a file but still want to fill out the "http request"
> according to what the server expects.

So make an empty one and provide that!

> And in this case the empty file would overwrite an exsisting file.

Ok. libcurl offers an "upload from buffer" method as well with
CURLFORM_BUFFER, but I don't know if PHP/CURL exposes that in anyway in its
API.

> Personally I'd be perfectly happy if only the php cURL libraries would let
> me supply my own HTTP requests without interference, but it messes them up
> somehow. I get the exact behaviour described here:
> http://dk2.php.net/manual/en/ref.curl.php#22857

CUSTOMREQUEST was always about adding your own request, not any header or
request-body.

> Does writing your own http requests work better with other versions of cURL?

First a quick recap on the names: cURL is the project. curl is the command
line tool. libcurl is the library and PHP/CURL is the PHP binding for libcurl.

libcurl and curl supports writing your own http requests just fine, in the
latest release and earlier. Just not exactly the way you seem to want it to.

I can't really speak for PHP/CURL.

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