cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Sending Large files via CURLOPT_HTTPPOST ?

From: Jeff Anderson <jganders_at_cox.net>
Date: Wed, 26 Jun 2002 02:48:20 -0700

That was it -- having the file in there twice. So curl was posting the
file twice with the same name and my serverside script was choking on
that. Once the file sizes got large, the script had a problem handling
DOUBLE that file size. I removed the second reference to the formadd
and it works fine now.

I copied that code from an example somewhere -- guess I misunderstood it
:)

Thanks for your quick response! Problem solved.

Jeff

> -----Original Message-----
> From: curl-library-admin_at_lists.sourceforge.net
> [mailto:curl-library-admin_at_lists.sourceforge.net] On Behalf
> Of Daniel Stenberg
> Sent: Wednesday, June 26, 2002 12:13 AM
> To: Jeff Anderson
> Cc: libcurl Mailing list
> Subject: Re: Sending Large files via CURLOPT_HTTPPOST ?
>
>
> On Tue, 25 Jun 2002, Jeff Anderson wrote:
>
> > Hi all. Sorry if this is a newbie problem but:
>
> I don't think it is.
>
> > I am using Curllib (7.9.7 on Win32 from C++) to post binary
> files via
> > HTTP. It works great for any file up to a certain size
> (haven't spent
> > the time to narrow it down exactly). But a file of
> 1,691,648 posted
> > fine, and a file of 3,059,712 bytes fails with error code 55
> > (CURLE_SEND_ERROR).
>
> Does the receiving end output anything back?
>
> > I know that my serverside code can take the large files, so
> I assume
> > this is some sort of buffer overrun. I am using the POSTEDFILESIZE
> > option, but it doesn't make any difference.
>
> POSTEDFILESIZE isn't making any difference when you're doing
> a multipart formpost.
>
> > Can anyone help me? Thank you very much and please excuse
> the newbie
> > question. My code is below:
>
> > /* Add simple file section */
> > curl_formadd(&post, &last, CURLFORM_COPYNAME, "MyFile",
> > CURLFORM_FILE, LocalFile, CURLFORM_END);
> >
> > /* Add file/contenttype section */
> > curl_formadd(&post, &last, CURLFORM_COPYNAME, "MyFile",
> > CURLFORM_FILE, LocalFile,
> > CURLFORM_CONTENTTYPE, "application/binary",
> > CURLFORM_END);
>
> This appends the same file, twice. Using the same name of the
> part ("MyFile"). If all you want is to send the file once
> using your custom content-type, then the second
> curl_formadd() invoke is the only one you need.
>
> libcurl doesn't consider this an error though but will try to
> do what you wish, and I can't tell why it fails sending this.
>
> I don't think this is a buffer problem as the error
> CURLE_SEND_ERROR is returned in lib/sendf.c:270 (almost
> uniquely) and it does this when send() actually returned a
> failure (that wasn't due to EWOULDBLOCK).
>
> --
> Daniel Stenberg -- I'll be away for a month, starting tomorrow
>
>
>
>
>
> -------------------------------------------------------
> This sf.net email is sponsored by: Jabber Inc.
> Don't miss the IM event of the season | Special offer for
> OSDN members!
> JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
>

-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members!
JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
Received on 2002-06-26