Opens in a new tab
A picture of Jeff Brigman
I CODE TODAY FOR
A BETTER TOMORROW

Glossary Term

validate_file()

3 tags 1 category

validate_file() — Validates a file name and path against an allowed set of rules. A return value of 1 means the file path contains directory traversal. A return value of 2 means the file path contains an absolute Windows path. This covers drive paths such as C:/WINDOWS, UNC network share paths such as //server/share, and the Windows device namespaces //./ and //?/. A return value of 3 means the file is not in the allowed files list. A return value of 0 means no file was provided or processed. Note that absolute POSIX paths such as /etc/passwd are *not* rejected, and never have been.

Inputs: $file (string): File path. $allowed_files (string[]): Optional. Array of allowed files. Default empty array.

Returns int: 0 means nothing is wrong, greater than 0 means something was wrong.

Term Connections

Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.

Loading term connections…