$tmpfile = $file['tmp_name'];
//First, does the file have a valid name?
- $reg = "/^(.[^" . implode('', $this->bad_chars) . "]+)\.(" .
+ $reg = "/^([^" . implode('', $this->bad_chars) . "]+)\.(" .
implode('|', $this->allowed_extensions) . ")$/i";
if ( preg_match($reg, $name, $matches) ) {
Analog::log(
$extension = 'jpg';
}
} else {
- $erreg = "/^(.[^" . implode('', $this->bad_chars) . "]+)\.(.*)/i";
+ $erreg = "/^([^" . implode('', $this->bad_chars) . "]+)\.(.*)/i";
$m = preg_match($erreg, $name, $errmatches);
$err_msg = '[' . $class . '] ';
$tmpfile = $file['tmp_name'];
//First, does the file have a valid name?
- $reg = "/^(.[^" . implode('', $this->bad_chars) . "]+)\.";
+ $reg = "/^([^" . implode('', $this->bad_chars) . "]+)\.";
if ( count($this->allowed_extensions) > 0 ) {
$reg .= "(" . implode('|', $this->allowed_extensions) . ")";
} else {
);
$extension = strtolower($matches[2]);
} else {
- $erreg = "/^(.[^" . implode('', $this->bad_chars) . "]+)\.(.*)/i";
+ $erreg = "/^([^" . implode('', $this->bad_chars) . "]+)\.(.*)/i";
$m = preg_match($erreg, $this->name, $errmatches);
$err_msg = '[' . $class . '] ';
*/
public function getBadChars()
{
- $ret = '';
- foreach ( $this->bad_chars as $char=>$regchar ) {
- $ret .= '`' . $char . '`, ';
- }
- return $ret;
+ return '`' . implode('`, `', array_keys($this->bad_chars)) . '`';
}
/**