Test files › Images › no-extension
PNG file with no extension
A genuinely valid PNG with no file extension at all.
↓ Download no-extension| Filename | no-extension |
| Format | PNG (no extension) |
| Size | 183 bytes (183 bytes) |
| MIME type | application/octet-stream |
| SHA-256 | c84d8425542305e68c674701ed5a8db2f4e6fe0045d8543be22ca3ddc0a88f40 |
What this file catchesThe mirror image of the case above: pipelines that route on extension will reject a perfectly good image. Content sniffing should accept this one.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Identify the file by its first bytes and compare that with the name. Never trust the extension or the Content-Type the browser sent.
SIGNATURES = {
b"\x89PNG\r\n\x1a\n": "png", b"\xff\xd8\xff": "jpg", b"GIF8": "gif",
b"%PDF-": "pdf", b"PK\x03\x04": "zip", b"MZ": "exe", b"\x7fELF": "elf",
}
def sniff(path):
with open(path, "rb") as f:
head = f.read(16)
return next((ext for sig, ext in SIGNATURES.items() if head.startswith(sig)), None)
name = "no-extension"
actual = sniff(name)
claimed = name.rsplit(".", 1)[1].lower() if "." in name else None
claimed = {"jpeg": "jpg", "jpe": "jpg"}.get(claimed, claimed)
verdict = "ok" if actual == claimed else "MISMATCH: reject it"
print(f"name says {claimed or 'nothing'}, bytes say {actual or 'unknown'}: {verdict}")Run against this file, it prints: name says nothing, bytes say png: MISMATCH: reject it
Related guides and tools
Sample PNG fileFile signaturesMIME typesUpload validation checklistCheck a file's real typeVerify its SHA-256
Download & verify
curl -fsSL -o "no-extension" "https://files.hexaqa.com/image/no-extension"
curl -fsSL "https://files.hexaqa.com/image/no-extension" | sha256sum
# expect: c84d8425542305e68c674701ed5a8db2f4e6fe0045d8543be22ca3ddc0a88f40