final class UploadService (View source)

internal  Applications should select configured uploaders through UploadFactory.
 

Coordinates validation, storage, and optional image processing for uploaded files.

Methods

__construct(FileUploadValidator $fileValidator, ImageUploadValidator $imageValidator, UploadStorage $storage, ImageEncoderInterface $imageEncoder, UploadStaging $staging)

Creates the upload workflow from validation, storage, and image-processing boundaries.

uploadFile(UploadedFileInterface|null $file, FileUploadOptions $options, string|null $publicationToken = null, bool $allowExistingIdentical = false)

Validates and stores a generic uploaded file, optionally using an idempotent server-owned publication token.

uploadImage(UploadedFileInterface|null $file, ImageUploadOptions $options, string|null $publicationToken = null, bool $allowExistingIdentical = false)

Validates and stores an image, optionally re-encoding it and reusing identical token-owned output on retry.

Details

__construct

__construct(FileUploadValidator $fileValidator, ImageUploadValidator $imageValidator, UploadStorage $storage, ImageEncoderInterface $imageEncoder, UploadStaging $staging)

Creates the upload workflow from validation, storage, and image-processing boundaries.

Parameters

FileUploadValidator $fileValidator
ImageUploadValidator $imageValidator
UploadStorage $storage
ImageEncoderInterface $imageEncoder
UploadStaging $staging

uploadFile

UploadedFile uploadFile(UploadedFileInterface|null $file, FileUploadOptions $options, string|null $publicationToken = null, bool $allowExistingIdentical = false)

Validates and stores a generic uploaded file, optionally using an idempotent server-owned publication token.

Parameters

UploadedFileInterface|null $file
FileUploadOptions $options
string|null $publicationToken
bool $allowExistingIdentical

Return Value

UploadedFile

uploadImage

UploadedImage uploadImage(UploadedFileInterface|null $file, ImageUploadOptions $options, string|null $publicationToken = null, bool $allowExistingIdentical = false)

Validates and stores an image, optionally re-encoding it and reusing identical token-owned output on retry.

Parameters

UploadedFileInterface|null $file
ImageUploadOptions $options
string|null $publicationToken
bool $allowExistingIdentical

Return Value

UploadedImage