ChunkUploadService
final class ChunkUploadService (View source)
Coordinates sequential chunk transport before delegating completed files to the existing upload pipeline.
The service is request-scoped because it resolves the configured file or image uploader through UploadFactory.
Constants
| private MAX_FILENAME_BYTES |
|
| private MAX_PROFILE_BYTES |
|
Methods
Combines transport limits, temporary persistence, and the established profile-based upload boundary.
Returns the server-authoritative maximum payload size for one append request.
Creates a temporary session for an explicit file or image profile after resolving its maximum final size.
Returns server-authoritative metadata for an active session without exposing its payload.
Appends one non-empty permitted chunk at the exact next byte offset of an active session.
Verifies that the assembled payload is complete and submits it to the standard configured upload pipeline.
Idempotently removes a temporary session and all of its assembled data under its session lock.
Removes expired sessions, old unreadable metadata, and bounded inactive retirement leftovers.
Details
__construct
__construct(ChunkUploadConfig $config, FilesystemChunkUploadSessionStore $store, UploadFactory $uploads, UploadStorage $storage, UploadService $uploadService)
Combines transport limits, temporary persistence, and the established profile-based upload boundary.
chunkBytes
int
chunkBytes()
Returns the server-authoritative maximum payload size for one append request.
start
ChunkUploadSession
start(string $kind, string $profile, string $originalFilename, int $declaredSize, array $context = [])
Creates a temporary session for an explicit file or image profile after resolving its maximum final size.
The declared size is reserved as an upper bound before any chunk data is written.
session
ChunkUploadSessionDescriptor
session(string $uploadId)
Returns server-authoritative metadata for an active session without exposing its payload.
append
ChunkUploadSession
append(string $uploadId, int $offset, StreamInterface $body)
Appends one non-empty permitted chunk at the exact next byte offset of an active session.
The body is read under the session lock and cannot advance metadata unless the complete chunk is persisted.
complete
UploadedFile|UploadedImage
complete(string $uploadId)
Verifies that the assembled payload is complete and submits it to the standard configured upload pipeline.
Validation failures discard the temporary session, while unexpected storage or infrastructure failures leave it intact.
abort
void
abort(string $uploadId)
Idempotently removes a temporary session and all of its assembled data under its session lock.
cleanupExpired
array
cleanupExpired()
Removes expired sessions, old unreadable metadata, and bounded inactive retirement leftovers.