i have a little curl script that i'm trying to post a image to another php page
i have a big problem with the correct syntax to use to post a image
the form submits correctly all other infomation but the image is never uploaded, i think i am doing something wrong can anyone please help me in the correct syntax to use in order to upload a image in a form with curl
the images are on my localhost stored under C:/images/file.jpg
heres the code i'm using that does not work
$post_site ="http://mysite.com";
$id ="2";
$imageone = "C:/xampp/htdocs/curlbot/file-images/2386.jpg";
// Now hit the posting page to post the event
$ptarget = $post_site . "/index.php?action=edit_listing_images";
$ch = curl_init();
curl_setopt ($ch, CURLOPT_COOKIEJAR, 'C:\xampp\htdocs\curlbot\cookies.txt'); //cookies.txt
curl_setopt ($ch, CURLOPT_COOKIEFILE, 'C:\xampp\htdocs\curlbot\cookies.txt'); //cookies.txt
curl_setopt ($ch, CURLOPT_URL, $ptarget);
curl_setopt ($ch, CURLOPT_POSTFIELDS, 'action=upload&edit='.$id.'&MAX_FILE_SIZE=200000&userfile[]='.$imageone.'&submit=Upload+picture');
curl_setopt ($ch, CURLOPT_HEADER, 0);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1);
$result= curl_exec ($ch);
curl_close ($ch);
print $result;
the problem seems to be with $imageone, every time i try to upload a jpg image, it keeps comming back file to large and just seems to be posting a .
i no theres something i'm not doing right, should i use a @ before the image somewhere, or could it be the c:/ path thats causing problems
any help whould be most usefull, i have search threw this site and google for answers but could not find any, i no theres something i'm missing, hopefully someone with more curl experiance than me can point me in the right direction
thanks in advance