lib/ValidationInputOne.php
public static function sanitizeFileName($filename) {
		if (empty($filename)) return "";
		if (function_exists("mb_ereg_replace")) {
			$filename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
			$filename = mb_ereg_replace("([\.]{2,})", '', $filename);
		} else {
			$filename = preg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
			$filename = preg_replace("([\.]{2,})", '', $filename);
		}
		return $filename;
	}
public static function sanitizeFileName($filename) {
		if (empty($filename)) return "";
		if (function_exists("mb_ereg_replace")) {
			$filename = mb_ereg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
			$filename = mb_ereg_replace("([\.]{2,})", '', $filename);
		} else {
			$filename = preg_replace("([^\w\s\d\-_~,;\[\]\(\).])", '', $filename);
			$filename = preg_replace("([\.]{2,})", '', $filename);
		}
		return $filename;
	}
public static function sanitizeFileName ( $ filename ) { if ( empty ( $ filename ) ) return "" ; if ( function_exists ( "mb_ereg_replace" ) ) { $ filename = mb_ereg_replace ( "([^\w\s\d\-_~,;\[\]\(\).])" , '' , $ filename ) ; $ filename = mb_ereg_replace ( "([\.]{2,})" , '' , $ filename ) ; } else { $ filename = preg_replace ( "([^\w\s\d\-_~,;\[\]\(\).])" , '' , $ filename ) ; $ filename = preg_replace ( "([\.]{2,})" , '' , $ filename ) ; } return $ filename ; }
Sanitize a filename removing .. and other nasty characters.
if mb_string is available then it also allows multibyte string characters such as accents.
@param string $filename
@return false|string|null
Sanitize a filename removing .. and other nasty characters . if mb_string is available then it also allows multibyte string characters such as accents .