Works on this device
Filename Allowlist Tester
Test the rules your upload form uses to accept file names. Type the extensions you allow, choose your rules, and paste names to test. The tool says which names your rules accept or refuse, lists every rule a name breaks, and notes risks your rules let through.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Test the names.
Your result
How it was worked out
How to use the filename allowlist tester
- Type the extensions you allow, such as
jpg, png, pdf. - Choose how the extension is checked: only the last extension, every extension, or exactly one.
- Choose whether capital letters matter, which characters are allowed, and the other rules.
- Type or paste the names to test, one on each line. Write hard-to-type characters as
\u{202E}. - Choose Test the names. Each row shows the result, the extension, the rules broken and risk notes.
The rules the tool can test
- Extensions are the parts after the first dot that is not at the start of the name:
shell.php.jpghas.phpand.jpg;.htaccesshas none. - Last extension only: the name ends with an allowed extension.
shell.php.jpgpasses this rule, so the tool notes the double extension. - Every extension or exactly one extension: stricter rules that refuse
shell.php.jpg. - Capital letters: with "do not matter",
photo.JPGmatchesjpg. - Characters: refuse invisible and direction characters (Unicode category Cf, such as U+202E, which can make
invoice[U+202E]gpj.exelook likeinvoiceexe.jpg), allow only plain ASCII, or allow any characters. - Dots and spaces at the end: Windows removes them, so
shell.php.is saved asshell.php. - Reserved Windows names: CON, PRN, AUX, NUL, COM0 to COM9, LPT0 to LPT9 (and COM or LPT with ¹ ² ³), also with an extension, such as
CON.jpg; and the characters< > : " | ? *. - Always checked: an empty name,
/or\(a path), control characters, and the longest name you allow.
Worked example
With the starting rules and names, 4 of 13 names pass: photo.jpg, photo.JPG, shell.php.jpg and the name résumé.pdf typed with separate accents. Two of them have risk notes: shell.php.jpg has two extensions, and the accented name is not in NFC form. shell.jpg.php is refused because its last extension .php is not in the list, and CON.jpg because CON is a reserved Windows name.
Limits you should know
- The tool tests your rules as you set them. It does not say what a real server, operating system or browser does with a file.
- A name is not proof of what a file holds. Check the content of each upload too, and store uploads under names your server makes.
- NFC and NFKC normal forms use the Unicode data of your browser.
- Reserved Windows names follow the Microsoft document "Naming Files, Paths, and Namespaces". Other systems have other rules.