cURL / Mailing Lists / curl-library / Single Mail


posting large amounts of data

From: Alan Wolfe <>
Date: Thu, 26 Jun 2008 11:05:34 -0700


I'm trying to get some code to work with the google youtube API for
uploading videos and it's all going well but I had a question...

Right now for the post data i'm allocating enough memory to hold some
metadata and the video data, loading it all up and then using curl_easy_setopt
with CURLOPT_POSTFIELDS to set the post data to that large bugger.

Youtube says it accepts videos up to 1GB in size though and i was thinking
it would be pretty wasteful to upload a 500MB video file (for instance) in
this fashion where it pre-allocates the full 500MB up front.

Is there a way with libcurl to do something such as calculate the size of
the post data up front (to set the content length value manually) and then
as curl is sending the post data, to actually stream the post data from

The format of the post data is...

<some mxl meta data about the video>
<video data>
<a footer after the video data showing where the end of the data is>

Would something like that be easily done?

Thanks a bunch for the help!
Received on 2008-06-26