forked from loafle/openapi-generator-original
Use CURLFile object on PHP5.5+.
This commit is contained in:
parent
09c5aa3827
commit
d907822fa9
@ -140,7 +140,18 @@ use \{{invokerPackage}}\ObjectSerializer;
|
|||||||
}{{/pathParams}}
|
}{{/pathParams}}
|
||||||
{{#formParams}}// form params
|
{{#formParams}}// form params
|
||||||
if (${{paramName}} !== null) {
|
if (${{paramName}} !== null) {
|
||||||
$formParams['{{baseName}}'] = {{#isFile}}'@' . {{/isFile}}$this->apiClient->getSerializer()->toFormValue(${{paramName}});
|
{{#isFile}}
|
||||||
|
// PHP 5.5 introduced a CurlFile object that deprecates the old @filename syntax
|
||||||
|
// See: https://wiki.php.net/rfc/curl-file-upload
|
||||||
|
if (function_exists('curl_file_create')) {
|
||||||
|
$formParams['{{baseName}}'] = curl_file_create($this->apiClient->getSerializer()->toFormValue(${{paramName}}));
|
||||||
|
} else {
|
||||||
|
$formParams['{{baseName}}'] = '@' . $this->apiClient->getSerializer()->toFormValue(${{paramName}});
|
||||||
|
}
|
||||||
|
{{/isFile}}
|
||||||
|
{{^isFile}}
|
||||||
|
$formParams['{{baseName}}'] = $this->apiClient->getSerializer()->toFormValue(${{paramName}});
|
||||||
|
{{/isFile}}
|
||||||
}{{/formParams}}
|
}{{/formParams}}
|
||||||
{{#bodyParams}}// body params
|
{{#bodyParams}}// body params
|
||||||
$_tempBody = null;
|
$_tempBody = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user