public function addFile($name, $fileName, $options = [])
    {
        $content = file_get_contents($fileName);
        if (!isset($options['mimeType'])) {
            $options['mimeType'] = FileHelper::getMimeType($fileName);
        }
        if (!isset($options['fileName'])) {
            $options['fileName'] = basename($fileName);
        }
        return $this->addContent($name, $content, $options);
    }
public function addFile($name, $fileName, $options = [])
    {
        $content = file_get_contents($fileName);
        if (!isset($options['mimeType'])) {
            $options['mimeType'] = FileHelper::getMimeType($fileName);
        }
        if (!isset($options['fileName'])) {
            $options['fileName'] = basename($fileName);
        }
        return $this->addContent($name, $content, $options);
    }
public function addFile ( $ name , $ fileName , $ options = [ ] ) { $ content = file_get_contents ( $ fileName ) ; if ( ! isset ( $ options [ 'mimeType' ] ) ) { $ options [ 'mimeType' ] = FileHelper :: getMimeType ( $ fileName ) ; } if ( ! isset ( $ options [ 'fileName' ] ) ) { $ options [ 'fileName' ] = basename ( $ fileName ) ; } return $ this -> addContent ( $ name , $ content , $ options ) ; }
Adds a file for upload as multi-part content.
@see addContent()
@param string $name part (form input) name
@param string $fileName full name of the source file.
@param array $options content part options, valid options are:
- fileName - string, base name of the uploading file, if not set it base name of the source file will be used.
- mimeType - string, file mime type, if not set it will be determine automatically from source file.
@return $this
@throws \yii\base\InvalidConfigException
Adds a file for upload as multi - part content .