Sample files for MIME type and content validation testing
Files with correct, documented signatures for testing type detection and upload allow-lists.
There are three sources of truth about a file's type, and they can disagree: the extension in its name, the Content-Type the client declares, and the bytes of the file itself. Only the last is hard to fake.
Every format page here documents the MIME type and the leading signature bytes of that format, so you can check what your detection library reports against a file whose type is certain.
Recommended files
| File | Size | Why this one | Download |
|---|---|---|---|
| 10 KB PNG samplesample-png-10kb.png | 10 KB10,240 bytes | Unambiguous eight-byte signature | Download PNG |
| 50 KB DOCX samplesample-docx-50kb.docx | 50 KB51,200 bytes | ZIP-based format that is easily misdetected | Download DOCX |
| 10 KB WebP samplesample-webp-10kb.webp | 10 KB10,240 bytes | RIFF container shared with WAV | Download WebP |
| File without an extensionsample-file-without-extension | 61 B61 bytes | No extension to rely on | Download TXT |
| 1 KB SVG samplesample-svg-1kb.svg | 1 KB1,024 bytes | Text file that browsers treat as an active document | Download SVG |
| 100 KB WebM samplesample-webm-100kb.webm | 100 KB102,400 bytes | Same four signature bytes as MKV | Download WebM |
| 100 KB M4A samplesample-m4a-100kb.m4a | 100 KB102,400 bytes | Audio in the container MP4 video uses | Download M4A |
Checklist
Verify detection on genuine files
Run your detector over one sample of each accepted format and compare with the MIME type on the format page.
Rename a file
Change the extension of a PNG to .pdf and upload it. Validation based on content should refuse it.
Lie in the header
Send a real PDF with Content-Type: image/png. The server should trust neither the header nor the name.
Test the ambiguous cases
DOCX, XLSX, PPTX and EPUB all begin with the ZIP signature. Plain text, CSV and INI have no signature at all.
Check what you serve back
Stored files should be returned with the detected type and X-Content-Type-Options: nosniff.
Guides
- How to test file upload: a complete checklist
A test plan for upload forms and endpoints, with the right sample file for every case.
Related use cases
Frequently asked questions
- Is checking the file extension enough?
- No. Anyone can rename a file. Use the extension as a first filter, then confirm the content with a signature check or a real parser.
- Why does my library report application/zip for a Word document?
- A DOCX file is a ZIP archive. Libraries that only read the leading bytes cannot tell the difference; better ones inspect the entries inside.
Test plan architecture and assertion matrix for sample files for mime type and content validation testing
A thorough mime type testing workflow separates positive functional verification (confirming well-formed inputs succeed and preserve their SHA-256 checksum) from negative boundary verification (confirming oversized, truncated, or mislabelled inputs fail with structured diagnostic codes).
| Test case ID | Scenario in mime type testing | Input fixture | Expected system outcome |
|---|---|---|---|
| TC-MIME-01 | Baseline small payload acceptance | 1 KB – 100 KB valid fixture from Formats | HTTP 200/201; stored byte count and SHA-256 match /checksums.txt |
| TC-MIME-02 | Gateway / reverse-proxy ceiling check | 1 MB, 10 MB, and 20 MB sized fixtures from Sizes | Exact threshold enforced; oversize payload returns HTTP 413 Payload Too Large |
| TC-MIME-03 | Extension vs. magic-byte mismatch | wrong-extension-png-as-jpg.jpg from Broken Files | Validator detects 89 50 4E 47 PNG header and rejects spoofed .jpg extension |
| TC-MIME-04 | Truncated stream / unexpected EOF | Truncated PDF or JPEG from Broken Files | Parser catches missing trailer/EOI marker and returns HTTP 422 without leaking stack traces |
Automating mime type testing in CI/CD pipelines
To keep automated runs deterministic and fast, commit your small sub-100 KB fixtures directly to your repository and synthesize larger 10 MB to 1 GB stress fixtures on demand using our in-browser generator or the reproducible local commands on Methodology. When testing tabular or relational data pipelines during mime type testing, pair binary container checks with our 100-row and 1,000-row synthetic datasets so you can assert exact row counts and column aggregations after ingestion.