- /**
- * Clean the file name for security
- *
- * @access public
- * @param string
- * @return string
- */
- function clean_file_name($filename)
- {
- $bad=array(
- "<!--",
- "-->",
- "'",
- "<",
- ">",
- '"',
- '&',
- '$',
- '=',
- ';',
- '?',
- '/',
- "%20",
- "%22",
- "%3c", // <
- "%253c", // <
- "%3e", // >
- "%0e", // >
- "%28", // (
- "%29", // )
- "%2528", // (
- "%26", // &
- "%24", // $
- "%3f", // ?
- "%3b", // ;
- "%3d" // =
- );
- $filename=str_replace($bad,'',$filename);
- returnstripslashes($filename);
- }
↧
How to clean file name for security reasons in PHP?
↧