$aPost = array(
'file' => new CURLFile($file)
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $response->response->upload_url);
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $aPost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$res = curl_exec ($ch);
curl_close($ch);
$res = json_decode($res);