Skip to content

Kirby 6.0.0

$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

Exceptions

Type Description
Kirby\Exception\DuplicateException Duplicate first chunk (same filename and id)
Kirby\Exception\InvalidArgumentException Too short ID string
Kirby\Exception\InvalidArgumentException Chunk offset does not match existing tmp file
Kirby\Exception\InvalidArgumentException The maximum file size for this blueprint was exceeded
Kirby\Exception\InvalidArgumentException Template or total length changed between chunks
Kirby\Exception\NotFoundException Subsequent chunk has no existing tmp file

Parent class

Kirby\Api\Upload