cURL / Mailing Lists / curl-users / Single Mail

curl-users

Problem transferring *.tar.gz file

From: Ajit, Kumar (IE10) <ajit.kumar_at_honeywell.com>
Date: Thu, 4 Apr 2002 22:25:00 -0600

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