cURL / Mailing Lists / curl-library / Single Mail


RE: Reg:FTP upload in libcurl

From: <>
Date: Fri, 20 Jun 2008 09:12:56 +0530

Hi all

>>>>Using what libcurl version on what platform?

Using libcurl version on 17.8.1 and linux .

I am coding in C++.

The below are member fucntions are of class FTP_TEST

This the code for Connect() funciton

   char * REMOTE_URL=new char[100];
      strcpy(REMOTE_URL,"ftp:// <ftp://> ");


     res = curl_easy_perform(curl);

void CurlInternalSettings()

   curl = curl_easy_init();
   if(curl) {


UploadFile_FTP(remoetpath,local path)
    FILE *hd_src;
    struct stat file_info;

 char *UPLOAD_FILE_AS=new char[255];


   struct curl_slist *headerlist=NULL;

   char *buf_1=new char [255];

   if(curl) {
    headerlist = curl_slist_append(headerlist, buf_1);
   // headerlist = curl_slist_append(headerlist, buf_2);
// curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback);
// curl_easy_setopt(curl, CURLOPT_INFILE,&file_info);
     curl_easy_setopt(curl, CURLOPT_UPLOAD,1);
     curl_easy_setopt(curl, CURLOPT_INFILESIZE,
should this line be () or is there any other way i can send my file
     curl_easy_setopt(curl, CURLOPT_PREQUOTE, headerlist);
     curl_easy_setopt(curl, CURLOPT_READDATA, hd_src);
    res = curl_easy_perform(curl);

I create a object of type FTP_TEST

Ob1.Connect()-->This is working fine.
Ob1.Uploadfile_FTP (localpath,remotepath);

In Uploadfile_FTP I am Re-Using the Connection.Now I want to send the



-----Original Message-----
[] On Behalf Of Daniel Stenberg
Sent: Friday, June 20, 2008 2:15 AM
To: libcurl development
Subject: Re: Reg:FTP upload in libcurl

On Thu, 19 Jun 2008, wrote:

> I am Establishing the conneciton in function called connect()

Using what libcurl version on what platform?

> how do i pass the file name to a old connection (old URL)

A connection has no "file name". What exactly are you trying to do?

> * Re-using existing connection! (#0) with host <Servername>
> * Connected to <Servername> (<Server IP> ) port 21 (#0)
> * Uploading to a URL without a file name!

This means your URL ends with a slash.

> * Uploaded unaligned file size (0 out of 13 bytes)

This means the upload failed.

> * URL using bad/illegal format or missing URL

Now this is funny, but I figure this is because your URL contains some
funny letter or something.

Perhaps you better show us exactly what your code is doing...

Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
Received on 2008-06-20