CI_Security::sanitize_filename PHP Method

sanitize_filename() public method

Sanitize Filename
public sanitize_filename ( string $str, boolean $relative_path = FALSE ) : string
$str string Input file name
$relative_path boolean Whether to preserve paths
return string
    public function sanitize_filename($str, $relative_path = FALSE)
    {
        $bad = $this->filename_bad_chars;
        if (!$relative_path) {
            $bad[] = './';
            $bad[] = '/';
        }
        $str = remove_invisible_characters($str, FALSE);
        do {
            $old = $str;
            $str = str_replace($bad, '', $str);
        } while ($old !== $str);
        return stripslashes($str);
    }