public function getFileContent()
    {
        $file = $this->getAttribute('file');
        if (empty($file) && !$this->getIsNewRecord()) {
            $file = $this->refreshFile();
        }

        if (empty($file)) {
            return null;
        } elseif ($file instanceof Download) {
            $fileSize = $file->getSize();
            return empty($fileSize) ? null : $file->toString();
        } elseif ($file instanceof UploadedFile) {
            return file_get_contents($file->tempName);
        } elseif (is_string($file)) {
            if (file_exists($file)) {
                return file_get_contents($file);
            }
            throw new InvalidParamException("File '{$file}' does not exist.");
        }

        throw new InvalidParamException('Unsupported type of "file" attribute.');
    }
public function getFileContent()
    {
        $file = $this->getAttribute('file');
        if (empty($file) && !$this->getIsNewRecord()) {
            $file = $this->refreshFile();
        }

        if (empty($file)) {
            return null;
        } elseif ($file instanceof Download) {
            $fileSize = $file->getSize();
            return empty($fileSize) ? null : $file->toString();
        } elseif ($file instanceof UploadedFile) {
            return file_get_contents($file->tempName);
        } elseif (is_string($file)) {
            if (file_exists($file)) {
                return file_get_contents($file);
            }
            throw new InvalidParamException("File '{$file}' does not exist.");
        }

        throw new InvalidParamException('Unsupported type of "file" attribute.');
    }
public function getFileContent ( ) { $ file = $ this -> getAttribute ( 'file' ) ; if ( empty ( $ file ) && ! $ this -> getIsNewRecord ( ) ) { $ file = $ this -> refreshFile ( ) ; } if ( empty ( $ file ) ) { return null ; } elseif ( $ file instanceof Download ) { $ fileSize = $ file -> getSize ( ) ; return empty ( $ fileSize ) ? null : $ file -> toString ( ) ; } elseif ( $ file instanceof UploadedFile ) { return file_get_contents ( $ file -> tempName ) ; } elseif ( is_string ( $ file ) ) { if ( file_exists ( $ file ) ) { return file_get_contents ( $ file ) ; } throw new InvalidParamException ( "File '{$file}' does not exist." ) ; } throw new InvalidParamException ( 'Unsupported type of "file" attribute.' ) ; }
Returns the associated file content.
@return null|string file content.
@throws \yii\base\InvalidParamException on invalid file attribute value.
Returns the associated file content .