// set size of the image, which isn't _mandatory_ but helps libcurl to do
// extra error checking on the upload.
curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));
curl_exec($ch);
echo "<pre>";
print_r(curl_getinfo($ch));
echo "\n cURL error number:" .curl_errno($ch);
echo "\n cURL error:" . curl_error($ch);
// check $error here to see if it did fine or not!