FileUploadValidator
final class FileUploadValidator (View source)
| internal | UploadService supplies only sealed private snapshots created by UploadStaging. |
Validates generic uploads against transport, byte limits, explicit extension policy, and detected content.
A client MIME declaration is never trusted: the temporary payload is detected server-side and must match its filename extension through MimeTypeCatalog.
Methods
Combines translated validation failures with server-side MIME detection and catalog compatibility rules.
Accepts a payload only after its transport state, size, explicit extension, and detected MIME family agree.
Details
__construct
__construct(TranslatorInterface $translator, MimeTypeDetectorInterface $detector, MimeTypeCatalog $catalog, UploadRiskPolicy $riskPolicy = new UploadRiskPolicy())
Combines translated validation failures with server-side MIME detection and catalog compatibility rules.
validate
MimeType
validate(StagedUpload $file, FileUploadOptions $options)
Accepts a payload only after its transport state, size, explicit extension, and detected MIME family agree.
The returned MIME is detected from temporary server-visible bytes, never the client declaration.