Founding price: $35, then $99 after 23:59 UTC on 4 November, then $99
Get ProReads the first bytes of a file to confirm it really is a PNG, JPEG, GIF, WebP or PDF rather than trusting its name or MIME type, and rejects renamed files with a precise message. Use this when a mislabelled upload would cause problems downstream.
This item has no props to tune. Use the lens above to change theme, density, direction and more.
Uploaded files are processed or shown to others, and a renamed executable or HTML file posing as an image is a risk.
Do not use it when: Client checks are for helpful errors, not security. Validate again on the server, always.
This item is part of tealmac UI Pro
The source for this item installs with a Pro licence key. Log in with your key to see the install command, or read the Pro setup page.
| Prop | Type | Description |
|---|---|---|
allowed | SniffedType[] | image/png, image/jpeg, image/gif, image/webp, application/pdf. |
onAccepted | (files) => void | Called with the files that passed. |
sniffBytes(bytes) and sniffFile(file) are exported.
The pattern ships with a Testing Library test (file-type-sniffing-validation.test.tsx) that covers: its main behaviour, the keyboard path and the error or empty states.