PHP

PHP CURL FILE UPLOAD

CURL FILE UPLOAD

CREATE NEW CURL FILE $cf = new CURLFile("FILE.EXT");   INIT CURL REQUEST $ch = curl_init();  curl_setopt($ch, CURLOPT_URL, "HTTP://SITE.COM/"); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS,  ["upload" => $cf] ); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);   RUN CURL REQUEST $result = curl_exec($ch); echo $result; curl_close($ch);

EXTRA - SAVE UPLOAD ON OTHER SERVER 

JUST MOVE THE UPLOADED FILE echo move_uploaded_file(   $_FILES['upload']['tmp_name'],   $_FILES['upload']['name'] ) ? "OK" : "ERROR" ;