My php curl upload script runs successfully on localhost but not on sever.. The curl is working fine for simple post but not for posting files. As soon as i start adding file to my post data ( prefixing file path with @ ), its showing nothing on server ($_FILE & $_POST both is found unset) while without the file, the $_POST is populated . I am using following script on my localhost and server too.
$request_url = 'http://localhost/curl_upload/curl_upload_process.php';
$post_params['uploadfile'] = '@'.'D:\images\photo-b4.jpg';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
curl_close($ch);
I have changed the request_url to the curl_upload_process.php file on the server. Its working fine on localhost for both simple post and file upload but not on server for only the file upload. Please let me know whats causing the problem to my script on the server.