cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Problem transferring *.tar.gz file

From: Cris Bailiff <c.bailiff_at_awayweb.com>
Date: Fri, 05 Apr 2002 16:23:12 +1000

Kumar,

you didn't show us what the definition of your readCallback function is
(or, actually, your INPUTFILE either).

If you don't have one, I can see that being one potential problem!

If you just

open INPUTFILE "<mydata.tar.gz"

you probably don't need READFUNCTION at all - the default function
should just read data straight from the filehandle.

I don't see why you should see any difference between text and binary -
assuming you are on a unix-like system, they're the 'same'.

Cris

Ajit, Kumar (IE10) wrote:
> Hi,
> I am trying to send a binary file (*.tar.gz) to a web server using this
> piece of code:
> ++++++++++++++++++++++++++++++++++++++++
> Curl::easy::setopt($curl, CURLOPT_READFUNCTION, \&readCallback);
> Curl::easy::setopt($curl, CURLOPT_INFILE, *INPUTFILE);
> Curl::easy::setopt($curl, CURLOPT_INFILESIZE, $bytesToBeUploaded);
> Curl::easy::setopt($curl, CURLOPT_UPLOAD, 1);
>
> if ($pszSendMethod eq "POST") {
> Curl::easy::setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
> } elsif ($pszSendMethod eq "PUT") {
> Curl::easy::setopt($curl, CURLOPT_PUT, 1);
> } else {
> $status = $ERR_METHOD_NOT_SUPPORTED;
> goto CLEANUP;
> }
> $status = Curl::easy::perform($curl);
>
> ++++++++++++++++++++++++++++++++++++++++
>
> The Curl::easy::perform() returns 0 but when I see the file size in the web
> server directory it's 1 byte. The same code works fine for transferring text
> file(*.txt). Can anybody point out what's going wrong or what extra I need
> to do to transfer the binary files.
> Thanks & regards
> Ajit
>
>
>
Received on 2002-04-05