yii\httpclient\Request::addFileContent PHP Method

addFileContent() public method

Adds a string as a file upload.
See also: addContent()
public addFileContent ( string $name, string $content, array $options = [] )
$name string part (form input) name
$content string file content.
$options array content part options, valid options are: - fileName - string, base name of the uploading file. - mimeType - string, file mime type, if not set it 'application/octet-stream' will be used.
    public function addFileContent($name, $content, $options = [])
    {
        if (!isset($options['mimeType'])) {
            $options['mimeType'] = 'application/octet-stream';
        }
        if (!isset($options['fileName'])) {
            $options['fileName'] = $name . '.dat';
        }
        return $this->addContent($name, $content, $options);
    }