MDL-45081 curl: Prefer usage of CURLFile over @file arguments

This commit is contained in:
Frederic Massart
2014-04-14 17:39:30 +08:00
parent 069fe267b6
commit 5b98627ae6
+7 -1
View File
@@ -401,7 +401,13 @@ class stored_file {
* @return void
*/
public function add_to_curl_request(&$curlrequest, $key) {
$curlrequest->_tmp_file_post_params[$key] = '@' . $this->get_content_file_location();
if (function_exists('curl_file_create')) {
// As of PHP 5.5, the usage of the @filename API for file uploading is deprecated.
$value = curl_file_create($this->get_content_file_location());
} else {
$value = '@' . $this->get_content_file_location();
}
$curlrequest->_tmp_file_post_params[$key] = $value;
}
/**