php文件上传到远程服务器

if (class_exists('\CURLFile')) {
    $field = array('fieldname' => new \CURLFile(realpath($filepath)));
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);
} else {
    $field = array('fieldname' => '@' . realpath($filepath));
curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);
}

猜你喜欢

转载自my.oschina.net/u/232595/blog/1822750