Use case · 31 files
Test error handling with corrupt files
Broken files reach every app eventually: interrupted uploads, half-written recordings, damaged archives and hand-edited JSON. These files reproduce each kind of corruption safely, so you can check that your code fails with a clear message instead of a crash, a hang or a half-processed result.
Download all with curl
# 31 files, 6.6 MB in total
while read -r url; do curl -LO --fail "$url"; done <<'EOF'
https://files.samplefiles.com/edge-cases/corrupt/truncated.jpg
https://files.samplefiles.com/edge-cases/corrupt/truncated.png
https://files.samplefiles.com/edge-cases/corrupt/truncated.gif
https://files.samplefiles.com/edge-cases/corrupt/truncated.webp
https://files.samplefiles.com/edge-cases/corrupt/truncated.mp4
https://files.samplefiles.com/edge-cases/corrupt/truncated.mp3
https://files.samplefiles.com/edge-cases/corrupt/truncated.wav
https://files.samplefiles.com/edge-cases/corrupt/truncated.flac
https://files.samplefiles.com/edge-cases/corrupt/truncated.pdf
https://files.samplefiles.com/edge-cases/corrupt/truncated.zip
https://files.samplefiles.com/edge-cases/corrupt/truncated.docx
https://files.samplefiles.com/edge-cases/corrupt/truncated.xlsx
https://files.samplefiles.com/edge-cases/corrupt/truncated.epub
https://files.samplefiles.com/edge-cases/corrupt/bad-signature.png
https://files.samplefiles.com/edge-cases/corrupt/bad-header.jpg
https://files.samplefiles.com/edge-cases/corrupt/crc-mismatch.zip
https://files.samplefiles.com/edge-cases/corrupt/corrupted-middle.mp3
https://files.samplefiles.com/edge-cases/corrupt/invalid.json
https://files.samplefiles.com/edge-cases/corrupt/malformed.xml
https://files.samplefiles.com/edge-cases/corrupt/malformed.csv
https://files.samplefiles.com/edge-cases/empty/zero-byte.pdf
https://files.samplefiles.com/edge-cases/empty/zero-byte.jpg
https://files.samplefiles.com/edge-cases/empty/zero-byte.mp4
https://files.samplefiles.com/edge-cases/empty/zero-byte.docx
https://files.samplefiles.com/edge-cases/empty/zero-byte.json
https://files.samplefiles.com/edge-cases/empty/empty-archive.zip
https://files.samplefiles.com/edge-cases/empty/header-only.csv
https://files.samplefiles.com/edge-cases/empty/blank-page.pdf
https://files.samplefiles.com/edge-cases/mislabeled/text-named.pdf
https://files.samplefiles.com/edge-cases/mislabeled/webm-named.mp4
https://files.samplefiles.com/edge-cases/mislabeled/mp3-named.wav
EOFRead first: Corrupt files for testing error handling · How to test file uploads properly · Validating uploads: magic bytes vs extension vs MIME type
Truncated media
The start of each file is valid, so format detection passes; the data runs out partway through.
| File | Size | Details | Download |
|---|---|---|---|
| Truncated JPGtruncated.jpg | 20.9 KB | Missing the EOI marker; most viewers render the top half and grey out the rest. | Download |
| Truncated PNGtruncated.png | 161 KB | Download | |
| Truncated GIFtruncated.gif | 198 KB | Download | |
| Truncated WEBPtruncated.webp | 9.8 KB | Download | |
| Truncated MP4truncated.mp4 | 532 KB | Download | |
| Truncated MP3truncated.mp3 | 234 KB | Download | |
| Truncated WAVtruncated.wav | 861 KB | Download | |
| Truncated FLACtruncated.flac | 499 KB | Download |
Truncated documents and archives
A PDF missing its cross-reference table, and ZIP-based files missing their central directory.
| File | Size | Details | Download |
|---|---|---|---|
| Truncated PDFtruncated.pdf | 9 KB | Download | |
| Truncated ZIPtruncated.zip | 523 KB | Download | |
| Truncated DOCXtruncated.docx | 19.8 KB | Download | |
| Truncated XLSXtruncated.xlsx | 56.2 KB | Download | |
| Truncated EPUBtruncated.epub | 34.5 KB | Download |
Damaged headers and data
Overwritten signatures that defeat format detection, and damage in the middle of otherwise valid files.
| File | Size | Details | Download |
|---|---|---|---|
| PNG with a damaged signaturebad-signature.png | 323 KB | Download | |
| JPG with a damaged headerbad-header.jpg | 41.8 KB | Download | |
| ZIP with a CRC errorcrc-mismatch.zip | 524 KB | Download | |
| MP3 with corrupted framescorrupted-middle.mp3 | 469 KB | Glitch at about 15 seconds. | Download |
Malformed text formats
Syntax errors that strict parsers must reject with a useful line and column.
| File | Size | Details | Download |
|---|---|---|---|
| Invalid JSONinvalid.json | 94 B | Download | |
| Malformed XMLmalformed.xml | 212 B | Download | |
| Malformed CSVmalformed.csv | 149 B | Download |
Empty files
Zero-byte files, and valid files with nothing in them, which should not be reported as corrupt.
| File | Size | Details | Download |
|---|---|---|---|
| Zero-byte .pdf filezero-byte.pdf | 0 B | Download | |
| Zero-byte .jpg filezero-byte.jpg | 0 B | Download | |
| Zero-byte .mp4 filezero-byte.mp4 | 0 B | Download | |
| Zero-byte .docx filezero-byte.docx | 0 B | Download | |
| Zero-byte .json filezero-byte.json | 0 B | Download | |
| Valid empty ZIPempty-archive.zip | 22 B | 0 entries | Download |
| CSV with a header and no rowsheader-only.csv | 30 B | 0 rows | Download |
| PDF with one blank pageblank-page.pdf | 1.2 KB | 1 page | Download |
Not what the name says
A text file named .pdf and a WebM named .mp4: valid content, wrong type.
| File | Size | Details | Download |
|---|---|---|---|
| Text file named .pdftext-named.pdf | 31 B | Download | |
| WebM video named .mp4webm-named.mp4 | 1.7 MB | Download | |
| MP3 file named .wavmp3-named.wav | 469 KB | Download |