cURL / Mailing Lists / curl-library / Single Mail

curl-library

uploading a file?????

From: neha bhagat <nehabhagat.4_at_gmail.com>
Date: Mon, 13 Apr 2009 14:57:51 +0530

I want to upload file in chunks.......

Say 8 MB file must be uploaded in 2 4MB chunks.........

Can I use CURLOPT_RANGE option?????

I have tried but it uploads chunks but not according to the offset ........

the code is as under:

 curl = curl_easy_init();

  if(NULL != curl)

  {

      res = curl_easy_setopt(curl, CURLOPT_URL, url);

      if(res !=0)

      {
          perror("error in url" );

          exit(1);
      }

      res = curl_easy_setopt(curl, CURLOPT_PUT, 1);

      if(res !=0)

      {
          perror("error in url" );

          exit(1);
      }

      res = curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);

      if(res !=0)

      {
          perror("error in url" );

          exit(1);
      }

      curl_off_t size=4 ;

      res = curl_easy_setopt(curl, CURLOPT_INFILESIZE, size);

      if(res !=0)

      {
          perror("error in url" );

          exit(1);
      }

      char * range = "3-6";

      res = curl_easy_setopt(curl, CURLOPT_RANGE, range);
        if(res!=0)
      {
          perror("error in url" );

          exit(1);
      }
Received on 2009-04-13