We were trying to integrate Picnik with our CMS called liveSite (
http://www.camelback.net/?t=forums.picnik.com). We were having a difficult time trying to upload a file to Picnik via cURL and PHP (it would just timeout), until we finally discovered that the line below is required.
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
We are using the code below successfully.
$file = '/path/to/example.gif';
$post_data = array();
$post_data['_import'] = 'image_file';
$post_data['image_file'] = "@$file";
$post_data['_returntype'] = 'text';
$post_data['_apikey'] = '*****';
// initialize cURL
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.picnik.com/service/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 999);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 0);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect:'));
// get cURL response
$response_data = curl_exec($ch);
We discovered this at the link below.
http://svn.concrete5-japan.org/svn/c5japan/5.3.3/trunk/concrete/tools/files/edit/image.phpHopefully this information saves someone a lot of time.