PHP Класс yii\mongodb\file\Upload

An Upload object is usually created by calling [[Collection::createUpload()]]. Note: instance of this class is 'single use' only. Do not attempt to use same Upload instance for multiple file upload. Usage example: php $document = Yii::$app->mongodb->getFileCollection()->createUpload() ->addContent('Part 1') ->addContent('Part 2') ... ->complete();
С версии: 2.1
Автор: Paul Klimov ([email protected])
Наследование: extends yii\base\Object
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$chunkCount file chunk counts.
$chunkSize chunk size in bytes.
$collection file collection to be used.
$document additional file document contents. Common GridFS columns: - metadata: array, additional data associated with the file. - aliases: array, an array of aliases. - contentType: string, content type to be stored with the file.
$filename filename to be used for file storage.
$length total upload length in bytes.

Открытые методы

Метод Описание
__destruct ( ) Destructor.
addContent ( string $content ) Adds string content to the upload.
addFile ( string $filename ) Adds a file content to the upload.
addStream ( resource $stream ) Adds stream content to the upload.
cancel ( ) Cancels the upload.
complete ( ) : array Completes upload.
init ( )

Приватные методы

Метод Описание
flushBuffer ( boolean $force = false ) Flushes [[buffer]] to the chunk if it is full.
insertChunk ( string $data ) Inserts file chunk.
insertFile ( ) : array Inserts [[document]] into file collection.

Описание методов

__destruct() публичный Метод

Makes sure abandoned upload is cancelled.
public __destruct ( )

addContent() публичный Метод

This method can invoked several times before Upload::complete is called.
public addContent ( string $content )
$content string binary content.

addFile() публичный Метод

This method can invoked several times before Upload::complete is called.
public addFile ( string $filename )
$filename string source file name.

addStream() публичный Метод

This method can invoked several times before Upload::complete is called.
public addStream ( resource $stream )
$stream resource data source stream.

cancel() публичный Метод

Cancels the upload.
public cancel ( )

complete() публичный Метод

Completes upload.
public complete ( ) : array
Результат array saved document.

init() публичный Метод

public init ( )

Описание свойств

$chunkCount публичное свойство

file chunk counts.
public $chunkCount

$chunkSize публичное свойство

chunk size in bytes.
public $chunkSize

$collection публичное свойство

file collection to be used.
public $collection

$document публичное свойство

additional file document contents. Common GridFS columns: - metadata: array, additional data associated with the file. - aliases: array, an array of aliases. - contentType: string, content type to be stored with the file.
public $document

$filename публичное свойство

filename to be used for file storage.
public $filename

$length публичное свойство

total upload length in bytes.
public $length