cURL / Mailing Lists / curl-users / Single Mail

curl-users

Facing an issue while doing FTP download for large file size:

From: lakshmi <lakshmi_at_dikshatech.com>
Date: Thu, 17 Mar 2011 18:10:53 +0530

Hi,

I am trying to do FTP download using the curl API "CURLOPT_MAXFILESIZE"
for a file which is of 400MB !

Curl API is:
       curl_easy_setopt(curlHandle_m, CURLOPT_MAXFILESIZE, 3L);

The following error occurs and the file doesn't get downloaded: "63
Maximum file size exceeded"

Version of Curl: curl-7.21.3

Environment: Redhat Linux 5.0

//CODE:-
FtpDownload(string url, string fileName, string userPwd,string mode) {
         if (curlHandle_m) {

           struct DownloadFileName ftpFile = { NULL, NULL };

           // Set the file name in which name the downloaded file would
be stored.
          if(fileName.c_str() != NULL)
               ftpFile.filename = fileName.c_str();
           else
               LOG_DEBUG(ACE_TEXT("File Name is empty.\n"));

           // Set source URL to transfer files from.
           curl_easy_setopt(curlHandle_m, CURLOPT_URL, url.c_str());

           curl_easy_setopt(curlHandle_m,
CURLOPT_WRITEFUNCTION,FileTransfer::CallBack);

            curl_easy_setopt(curlHandle_m, CURLOPT_WRITEDATA, &ftpFile);
           curl_easy_setopt(curlHandle_m, CURLOPT_MAXFILESIZE, 3L);

           // Allow the use of ftp only if this method is called.
           curl_easy_setopt(curlHandle_m, CURLOPT_PROTOCOLS,
CURLPROTO_FTP);

           // format "user:password"
           curl_easy_setopt(curlHandle_m,CURLOPT_USERPWD,userPwd.c_str());

           // set SSH authentication to user name and password
           
curl_easy_setopt(curlHandle_m,CURLOPT_SSH_AUTH_TYPES,CURLSSH_AUTH_PASSWORD);

           if(mode == "ascii"){
                   // ASCII mode
                   curl_easy_setopt(curlHandle_m,CURLOPT_TRANSFERTEXT,1);
           }
           else{
                   // Binary mode
                   curl_easy_setopt(curlHandle_m,CURLOPT_TRANSFERTEXT,0);
           }

           // Perform a file transfer.
           result_m = curl_easy_perform(curlHandle_m);
}

Can anyone please suggest me a solution to proceed on with this ..

Regards,
Lakshmi.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-03-17