1

Verot upload class (class.upload.php v3.2) gives an eror while upload and mime check.

if (preg_match("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", $this->file_src_mime)) {
                            $this->file_src_mime = preg_replace("/^([\.-\w]+)\/([\.-\w]+)(.*)$/i", '$1/$2', $this->file_src_mime);
                            $this->log .= '-&nbsp;MIME validated as ' . $this->file_src_mime . '<br />';
                        } else {
                            $this->file_src_mime = null;
}

This occurs an error:

Warning: preg_match() [function.preg-match]: Compilation failed: invalid range in character class at offset 7 in class.upload.php on line 2616

Thanks for suggestions.

1
  • - should be escaped too - \- Or put in the end of block [\.\w-] Commented Nov 23, 2014 at 18:06

2 Answers 2

2

[\.-\w] is illegal because \w is a character class, not a character. As written, your regex is looking for characters in the range . to \w, which makes no sense.

It's not clear to me what you are trying to do, but you can't do this.

I think you may want ., -, or word characters (anything matched by \w), in which case you should use [.\-\w].

Sign up to request clarification or add additional context in comments.

Comments

2

This is fixed in the latest version, which you can now find on Github: https://github.com/verot/class.upload.php (Creator of the class here)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.