Sample files for file upload testing
Test an upload form or endpoint with files of every size and type it should accept, and several it should refuse.
An upload feature has more ways to fail than almost any other part of a web application. The file may be too large, too small, the wrong type, misnamed, empty, or interrupted halfway. Each case needs a file that triggers it on demand.
The method is simple: for every rule your upload enforces, pick one file just inside the rule and one just outside it, and confirm that the first is accepted and the second is refused with a clear message.
Recommended files
| File | Size | Why this one | Download |
|---|---|---|---|
| 1 KB TXT samplesample-txt-1kb.txt | 1 KB1,024 bytes | Smallest happy-path upload | Download TXT |
| 1 MB PDF samplesample-pdf-1mb.pdf | 1 MB1,048,576 bytes | Exactly on the most common default limit | Download PDF |
| 5 MB JPG samplesample-jpg-5mb.jpg | 5 MB5,242,880 bytes | A realistic phone-photo size | Download JPG |
| 10 MB BIN samplesample-bin-10mb.bin | 10 MB10,485,760 bytes | Generic file to exceed a 10 MB limit | Download BIN |
| Empty file (0 bytes)empty-file.txt | 0 B0 bytes | Zero-byte edge case | Download TXT |
| File name with non-ASCII characterssample-ünïcödé-文件-имя.txt | 75 B75 bytes | Non-ASCII file name | Download TXT |
Checklist
Start with the smallest valid file
Upload a 1 KB text file to prove that the form, the endpoint and the storage are wired together before testing anything harder.
Test each accepted type
Upload one file of every type on your allow-list, and one that is not on it. Check that the refusal names the accepted types.
Walk the size limit
Upload files below, at and above your limit. Remember that a multipart request is slightly larger than the file it carries.
Try the zero-byte file
An empty file should be refused or handled deliberately, not stored as a broken record.
Try awkward file names
Spaces, non-ASCII characters and very long names expose encoding and truncation bugs in storage and download headers.
Interrupt a large upload
Cancel a 10 MB upload midway, then retry. No partial file should remain, and the retry should succeed.
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.
- How to test file size limits
Where upload limits live, what the common defaults are, and how to test a boundary to the byte.
- How to test MIME types and file type validation
Extensions, Content-Type headers and magic bytes: how to check that type validation cannot be fooled.
Related use cases
Frequently asked questions
- Which file should I use to test a 5 MB upload limit?
- Use the 5 MB sample in the format your form accepts, plus the 1 MB file to confirm success and the 10 MB file to confirm refusal. If the limit applies to the request body, the 5 MB file will already be slightly over once multipart overhead is added.
- Do I need different files for drag-and-drop and the file picker?
- No, but test both paths with the same file. They often run through different code in the browser.