curl-and-php
Re: curl Upload: command line OK - libcurl/PHP problem!
Date: Fri, 2 Apr 2004 14:44:57 +0200 (CEST)
On Fri, 2 Apr 2004, Harry Fearnley wrote:
> > In curl lingo, we don't speak of "upload" when we do a POST. A POST is
> > just a POST. Thus, you should not set the upload option. In your case, you
> > do a multipart formpost. (The differentiation may not matter, but the
> > PHP/CURL module has opted for a different approach to offer multipart
> > support so PHP programmers can't compare with other languages when it
> > comes to this.)
>
> ... multipart? -- see below.
> >>$result = curl_setopt($ch, CURLOPT_POSTFIELDS,
> >>"file=test.PDF&submit=Send%20Now");
> >
> > While this is POST data, it is not multipart data like you provided with
> > the command line tools.
>
> I do not see how to get the effect of the command line that worked! :-).
>
> What do I need to do here to specify multipart data?
Now you're reaching that part I was talking about that is offered very
differently in PHP than "regular" libcurl.
I believe you pass on a hash array to the CURLOPT_POSTFIELDS that is properly
crafted.
We have one example on the curl site that shows a file being posted this way:
http://curl.haxx.se/libcurl/php/examples/?ex=multipartpost.php
If you end up producing a better example code, I'm interested!
-- Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se Dedicated custom curl help for hire: http://haxx.se/curl.htmlReceived on 2004-04-02