cURL / Mailing Lists / curl-library / Single Mail


Re: Can I send only part of a file?

From: Dan Fandrich <>
Date: Mon, 9 May 2011 11:12:31 -0700

On Mon, May 09, 2011 at 10:26:52AM -0400, Saqib Ali wrote:
> I'm using Curl version 7.21.5 to do SFTP uploads from a Solaris 10 box.
> I have a relatively large file that I'm interested in transmitting (Approx 10
> MB). But the file is structured such that the information I'm really interested
> in transmitting is at the beginning of the file.
> Is it possible for me to instruct Curl to transmit only the first X bytes of a
> file?
> Could I accomplish this simply by setting the CURLOPT_INFILESIZE parameter to
> X?

The data sent by by libcurl comes from the CURLOPT_READFUNCTION callback
function which is part of your app. Once the app has finished sending all it
wants, just return the end-of-file indication to libcurl (instead of more
data) and it will complete the transfer.

>>> Dan
List admin:
Received on 2011-05-09