For all you geeks, finding an extension, cross platform, because application/type doesn’t always work with $_FILES['file']['type'] cross platform.
PHP
Finding Extensions in PHP without Reading the Mime Type
Restricting an input field to only numbers with preg_match_all() (PHP)
This is a pretty easy way to restrict a field to only numbers.
The \D in the preg match is short for [^0-9], which will match all characters, except 0-9.
I’m new to the regex, so there might be a better way to do this. But this works for me.
Recent Comments