Code: Select all
function upload($SITE, $TempFile, $UploadPath)
{
if($_SERVER['SERVER_NAME'] == 'media01')
$URL = 'http://media01/ramarkz/'.($SITE=='moviez'?'moviez/upload/upload.php':'giftz/upload/upload.php');
else
$URL = ($SITE=='moviez'?'http://www.somesite.com/upload/upload.php':'http://www.someothersite.com/upload/upload.php');
$ch = curl_init($URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, array("path"=>$UploadPath, "file"=>"@$TempFile"));
list($Result, $Reason) = explode("|", curl_exec($ch));
curl_close($ch);
$Reason = explode("~~~~~", $Reason); //explode any errors into array...
if($Result==0) // if there was an error...
foreach($Reason as $anErr)
catchErr($anErr);
return $Result==0?FALSE:TRUE;;
}