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

FileSizeWhy this oneDownload
1 KB TXT samplesample-txt-1kb.txt1 KB1,024 bytesSmallest happy-path uploadDownload TXT
1 MB PDF samplesample-pdf-1mb.pdf1 MB1,048,576 bytesExactly on the most common default limitDownload PDF
5 MB JPG samplesample-jpg-5mb.jpg5 MB5,242,880 bytesA realistic phone-photo sizeDownload JPG
10 MB BIN samplesample-bin-10mb.bin10 MB10,485,760 bytesGeneric file to exceed a 10 MB limitDownload BIN
Empty file (0 bytes)empty-file.txt0 B0 bytesZero-byte edge caseDownload TXT
File name with non-ASCII characterssample-ünïcödé-文件-имя.txt75 B75 bytesNon-ASCII file nameDownload TXT

Checklist

  1. 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.

  2. 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.

  3. 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.

  4. Try the zero-byte file

    An empty file should be refused or handled deliberately, not stored as a broken record.

  5. Try awkward file names

    Spaces, non-ASCII characters and very long names expose encoding and truncation bugs in storage and download headers.

  6. Interrupt a large upload

    Cancel a 10 MB upload midway, then retry. No partial file should remain, and the retry should succeed.

Guides

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.