Printable View
There is a cURL that processes the image and sends it to the server: PHP Code: if ($_POST["upload"]) { define('BASEPATH', str_replace('\\', '/', dirname(__FILE__)) . '/'); $upload_url = $_POST["upload"]; $post_params['file1'] = '@'.BASEPATH.'01.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params); $result = curl_exec($ch); curl_close($ch); echo $result; } In this case it takes the path ('@'.BASEPATH.'01.jpg') to the images with strictly specified name on my server... But how to take an image through a link with a variable (../image.php?image_id='.$img.') where $img is the name/number of image? Thanx
if ($_POST["upload"]) { define('BASEPATH', str_replace('\\', '/', dirname(__FILE__)) . '/'); $upload_url = $_POST["upload"]; $post_params['file1'] = '@'.BASEPATH.'01.jpg'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $upload_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params); $result = curl_exec($ch); curl_close($ch); echo $result; }
I'm out of practice with this specific task, but I wrote this a while back. Maybe it will help you: cURL multipart from data file upload.