Permalink
Browse files

Testing mime type with FINFO too.

  • Loading branch information...
1 parent 6075818 commit 1ebd7fbeee6623e24e732b0f3160f16ad1ca58ad @jrbasso jrbasso committed Sep 25, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 models/behaviors/meio_upload.php
@@ -548,7 +548,14 @@ function uploadCheckInvalidMime(&$model, $data) {
if ($info !== false && in_array($info['mime'], $options['allowedMime'])) {
continue;
}
- if (function_exists('mime_content_type')) {
+ if (function_exists('finfo_open')) {
+ $finfo = finfo_open(FILEINFO_MIME_TYPE);
+ $info = finfo_file($finfo, $field['tmp_name']);
+ if ($info !== false && in_array($info, $options['allowedMime'])) {
+ continue;
+ }
+ }
+ if (function_exists('mime_content_type')) { // @deprecated
$info = mime_content_type($field['tmp_name']);
if ($info !== false && in_array($info, $options['allowedMime'])) {
continue;

0 comments on commit 1ebd7fb

Please sign in to comment.