Bugfix in package name validation code

According to the docs (http://php.net/preg_match) preg_match() only returns a boolean false, when an error occurs, but not for valid searches without a result.
This change covers both cases.
Ignore case on file name check.
Fixed condition validating package name during local upload

* origin/pr/11275:
  Ignore case on file name check.
  Bugfix in package name validation code