aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_upload.php
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@gmx.de>2012-07-18 11:07:32 +0200
committerJoas Schilling <nickvergessen@gmx.de>2012-07-18 11:07:32 +0200
commitf4136eacdc319b2029692a9c19a845a115b94129 (patch)
treef610d14df9e80ee74e8b35e4e8b8183170555f02 /phpBB/includes/functions_upload.php
parent3637cd395e39c1fa5b7279222abe1da5d2abcd00 (diff)
parentb176b86f111a05338ed3c74026bcf19d42ec0ee3 (diff)
downloadforums-f4136eacdc319b2029692a9c19a845a115b94129.tar
forums-f4136eacdc319b2029692a9c19a845a115b94129.tar.gz
forums-f4136eacdc319b2029692a9c19a845a115b94129.tar.bz2
forums-f4136eacdc319b2029692a9c19a845a115b94129.tar.xz
forums-f4136eacdc319b2029692a9c19a845a115b94129.zip
Merge branch 'develop' of git://github.com/phpbb/phpbb3 into feature/new-tz-handling
Diffstat (limited to 'phpBB/includes/functions_upload.php')
-rw-r--r--phpBB/includes/functions_upload.php15
1 files changed, 6 insertions, 9 deletions
diff --git a/phpBB/includes/functions_upload.php b/phpBB/includes/functions_upload.php
index f70e20e616..33cb585b19 100644
--- a/phpBB/includes/functions_upload.php
+++ b/phpBB/includes/functions_upload.php
@@ -151,7 +151,8 @@ class filespec
*/
function is_image()
{
- return (strpos($this->mimetype, 'image/') !== false) ? true : false;
+ $mimetype = $this->get_mimetype($this->filename);
+ return (strpos($mimetype, 'image/') === 0);
}
/**
@@ -200,17 +201,12 @@ class filespec
}
/**
- * Get mimetype. Utilize mime_content_type if the function exist.
- * Not used at the moment...
+ * Get mimetype. Utilises the finfo class.
*/
function get_mimetype($filename)
{
- $mimetype = '';
-
- if (function_exists('mime_content_type'))
- {
- $mimetype = mime_content_type($filename);
- }
+ $finfo = new finfo(FILEINFO_MIME_TYPE);
+ $mimetype = $finfo->file($filename);
// Some browsers choke on a mimetype of application/octet-stream
if (!$mimetype || $mimetype == 'application/octet-stream')
@@ -342,6 +338,7 @@ class filespec
// Remove temporary filename
@unlink($this->filename);
+ $this->filename = $this->destination_file;
if (sizeof($this->error))
{