pimax\Messages\Message::getCurlValue PHP Method

getCurlValue() protected method

protected getCurlValue ( string $filename, string $contentType, string $postname ) : CURLFile | string
$filename string
$contentType string
$postname string
return CURLFile | string
    protected function getCurlValue($filename, $contentType, $postname)
    {
        // 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')) {
            return curl_file_create($filename, $contentType, $postname);
        }
        // Use the old style if using an older version of PHP
        $value = "@{$this->filename};filename=" . $postname;
        if ($contentType) {
            $value .= ';type=' . $contentType;
        }
        return $value;
    }