UploadStaging
final class UploadStaging (View source)
| internal | UploadService uses this boundary before any MIME, image, or final-storage operation. |
Creates sealed upload snapshots in private writable storage while enforcing byte limits during streaming.
Constants
| private COPY_BYTES |
|
| private CREATE_ATTEMPTS |
|
Methods
Retains the private path, filesystem, and translated failure boundaries used by every upload snapshot.
Copies an uploaded stream exactly once and returns its measured immutable snapshot.
Seals framework-generated bytes as a second private snapshot before final publication.
Verifies that a sealed snapshot still has its measured size and digest.
Removes a snapshot without allowing cleanup failures to hide the primary upload outcome.
Reclaims a bounded number of old snapshots whose process lease is no longer active.
Details
__construct
__construct(TranslatorInterface $translator, Filesystem $filesystem, UploadPathPolicy $pathPolicy, ChunkUploadConfig|null $cleanupConfig = null)
Retains the private path, filesystem, and translated failure boundaries used by every upload snapshot.
stage
StagedUpload
stage(UploadedFileInterface|null $file, int $maxBytes)
Copies an uploaded stream exactly once and returns its measured immutable snapshot.
The client-reported size is deliberately ignored; the byte limit is enforced before each staged write.
stageBytes
StagedUpload
stageBytes(string $contents, string $clientFilename, int $maxBytes)
Seals framework-generated bytes as a second private snapshot before final publication.
assertIntact
void
assertIntact(StagedUpload $upload)
Verifies that a sealed snapshot still has its measured size and digest.
discard
void
discard(StagedUpload|null $upload)
Removes a snapshot without allowing cleanup failures to hide the primary upload outcome.
cleanupOrphans
int
cleanupOrphans(int|null $now = null)
Reclaims a bounded number of old snapshots whose process lease is no longer active.
Files outside the private staging root, symbolic links, recent snapshots, and locked snapshots are ignored.