Skip to content

Kirby 5.1.3

$upload->processChunk()

Handle chunked uploads by merging all chunks in the tmp directory and only returning the new $source path to the tmp file once complete

$upload->processChunk() has been marked as unstable. It might be changed in a future Kirby major or minor release without being considered a breaking change. Use with caution.

$upload->processChunk(string $source, string $filename): string|null

Parameters

Name Type Default
$sourcerequired string no default value
$filenamerequired string no default value

Return types

stringornull

This method modifies the existing $upload object it is applied to and returns it again.

Exceptions

Type Description
Kirby\Exception\DuplicateException Duplicate first chunk (same filename and id)
Kirby\Exception\Exception Chunk offset does not match existing tmp file
Kirby\Exception\InvalidArgumentException Too short ID string
Kirby\Exception\NotFoundException Subsequent chunk has no existing tmp file

Parent class

Kirby\Api\Upload