public function file($file, $type, $filename = null)
    {
        $this->type = $type;

        if(is_file($file))
        {
            $this->payload['file'] = ['name' => $type, 'contents'=> fopen($file, 'r')];
            if($filename)
                $this->payload['file']['filename'] = $filename;
        }
        else
            $this->payload[$type] = $file;

        return $this;
    }
public function file($file, $type, $filename = null)
    {
        $this->type = $type;

        if(is_file($file))
        {
            $this->payload['file'] = ['name' => $type, 'contents'=> fopen($file, 'r')];
            if($filename)
                $this->payload['file']['filename'] = $filename;
        }
        else
            $this->payload[$type] = $file;

        return $this;
    }
public function file ( $ file , $ type , $ filename = null ) { $ this -> type = $ type ; if ( is_file ( $ file ) ) { $ this -> payload [ 'file' ] = [ 'name' => $ type , 'contents' => fopen ( $ file , 'r' ) ] ; if ( $ filename ) $ this -> payload [ 'file' ] [ 'filename' ] = $ filename ; } else $ this -> payload [ $ type ] = $ file ; return $ this ; }
add File to Message

@param string $file
@param string $type
@param string $filename

@return $this
add File to Message