diff --git a/src/JiraClient.php b/src/JiraClient.php index 1d1587a..d6d43b7 100644 --- a/src/JiraClient.php +++ b/src/JiraClient.php @@ -302,32 +302,20 @@ private function createUploadHandle(string $url, string $upload_file, \CurlHandl // send file curl_setopt($ch, CURLOPT_POST, true); - if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION < 5) { - $attachments = realpath($upload_file); - $filename = basename($upload_file); + // CURLFile require PHP > 5.5 + //$attachments = new \CURLFile(realpath($upload_file)); + $attachments = new \CURLFile(realpath($upload_file)); + $attachments->setPostFilename(basename($upload_file)); - curl_setopt( - $ch, - CURLOPT_POSTFIELDS, - ['file' => '@'.$attachments.';filename='.$filename] - ); - - $this->log->debug('using legacy file upload'); - } else { - // CURLFile require PHP > 5.5 - $attachments = new \CURLFile(realpath($upload_file)); - $attachments->setPostFilename(basename($upload_file)); - - curl_setopt( - $ch, - CURLOPT_POSTFIELDS, - ['file' => $attachments] - ); + curl_setopt( + $ch, + CURLOPT_POSTFIELDS, + ['file' => $attachments] + ); - $this->log->debug('using CURLFile='.var_export($attachments, true)); - } + $this->log->debug('using CURLFile='.var_export($attachments, true)); - $curl_http_headers = $this->curlPrepare($ch, $curl_http_headers); + $curl_http_headers = $this->curlPrepare($ch, $curl_http_headers, null); $this->proxyConfigCurlHandle($ch);