php5.5 and below: 'imageFile' =>'@'. realpath($fileName), php5.6 and above: 'imageFile' => new \CURLFile(realpath($fileName)),
final plan:
if (class_exists('\CURLFile')) {
$field = array('fieldname' => new \CURLFile(realpath($filepath)));
} else {
$field = array('fieldname' => '@' . realpath($filepath));
}