Commit 774543fd by Qiang Xue

Merge pull request #3785 from marciocamello/patch-2

mimeTypes Validator is wrong
parents 64618176 1bad91bd
...@@ -205,7 +205,7 @@ class FileValidator extends Validator ...@@ -205,7 +205,7 @@ class FileValidator extends Validator
return [$this->tooSmall, ['file' => $file->name, 'limit' => $this->minSize]]; return [$this->tooSmall, ['file' => $file->name, 'limit' => $this->minSize]];
} elseif (!empty($this->types) && !in_array(strtolower(pathinfo($file->name, PATHINFO_EXTENSION)), $this->types, true)) { } elseif (!empty($this->types) && !in_array(strtolower(pathinfo($file->name, PATHINFO_EXTENSION)), $this->types, true)) {
return [$this->wrongType, ['file' => $file->name, 'extensions' => implode(', ', $this->types)]]; return [$this->wrongType, ['file' => $file->name, 'extensions' => implode(', ', $this->types)]];
} elseif (!empty($this->mimeTypes) && !in_array(FileHelper::getMimeType($file->tempName), $this->mimeTypes, true)) { } elseif (!empty($this->mimeTypes) && !in_array(FileHelper::getMimeType($file->name), $this->mimeTypes, true)) {
return [$this->wrongMimeType, ['file' => $file->name, 'mimeTypes' => implode(', ', $this->mimeTypes)]]; return [$this->wrongMimeType, ['file' => $file->name, 'mimeTypes' => implode(', ', $this->mimeTypes)]];
} else { } else {
return null; return null;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment