cURL
Haxx ad
libcurl

curl's project page on SourceForge.net

Sponsors:
Haxx

cURL > Mailing List > Monthly Index > Single Mail

curl-library Mailing List Archives

RE: Need urgend help to use libcurl to transfer zip file via FTP

From: DISTEC Helwing Lutz <Helwing_at_distec.de>
Date: Mon, 21 Jun 2010 11:20:27 +0200

        From: Hanmei.Zhang_at_t-systems.com
[mailto:Hanmei.Zhang_at_t-systems.com]
        Sent: Monday, June 21, 2010 10:21 AM
        To: curl-library_at_cool.haxx.se
        Subject: Need urgend help to use libcurl to transfer zip file
via FTP
        
        

        Hi all,

        I need help urgently.
        I wanted to transfer zip file using libcurl via FTP from UNIX to
VMS. Although I told libcurl to use binary mode, it seems that it did
not work, because the zip file was modified after the transfer. Some
carriage returns in the zip file were converted to line feeds, so that
the unzip tool could not unzip the file.

        I did the transfer in the following way:

              ...
              curl_easy_setopt( curl, CURLOPT_CUSTOMREQUEST,"TYPE I" );
              res_g = curl_easy_perform( curl );

              curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST ,"RETR
test_zip.yyy");
              res = curl_easy_perform(curl);
              ...
        I tried a lot of options to be set, such as
CURLOPT_PROXY_TRANSFER_MODE, CURLOPT_CRLF ... and so on. But without
success.

        Can anyone help me? Or can anyone give me some suggestions or
hints?
        Thank you very much!

        Hanmei

Hi,
 
Do you really need a custom request here?
You can download a binary file like this (at least this works in my
case: Linux->Linux):
 
FILE *fdTargetBinFile;
 
/* open your target bin file pointer "wb" */
 
curl_easy_setopt( curl, CURLOPT_WRITEDATA, fdTargetBinFile);

curl_easy_setopt( curl, CURLOPT_URL, szUrlToRemoteFile);

...
 
curl_easy_perform(curl);
 
/* close your target bin file pointer */

I hope this is some help to you.
Cheers,
Lutz
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-06-21

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET