Saturday, 15 May 2010

PHP cURL set file as POST form input type file -



PHP cURL set file as POST form input type file -

i have page on different server <form> , utilize curl set info automatically. in form there file input <input name='file' type='file'> , aware of fact file input behaves differently others.

//this code till now. $ch = curl_init(); //page password protected not sure if works hope does. curl_setopt($ch, curlopt_url, "http://user:pass@mydomain.com/system_backup.php"); curl_setopt($ch, curlopt_post, 1); //set file post variable doesn't work curl_setopt($ch, curlopt_postfields, "file=".$file."&var1=".$var1."&var2=".$var2); $result = curl_exec($ch); curl_close($ch);

so question how set file postfield curl.

look @ guide, need prefix file total path '@'

php file curl

No comments:

Post a Comment