mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/10963] Modified filespec::is_image() to check actual mimetype
Modified filespec::is_image() to check the Fileinfo mimetype rather than trusting the browser. PHPBB3-10963
This commit is contained in:
parent
a0771b8814
commit
03ddfbbaf1
1 changed files with 5 additions and 1 deletions
|
@ -151,7 +151,10 @@ class filespec
|
|||
*/
|
||||
function is_image()
|
||||
{
|
||||
return (strpos($this->mimetype, 'image/') !== false) ? true : false;
|
||||
$finfo = new finfo(FILEINFO_MIME_TYPE);
|
||||
$mimetype = $finfo->file($this->filename);
|
||||
|
||||
return (strpos($mimetype, 'image/') !== false) ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -342,6 +345,7 @@ class filespec
|
|||
|
||||
// Remove temporary filename
|
||||
@unlink($this->filename);
|
||||
$this->filename = $this->destination_file;
|
||||
|
||||
if (sizeof($this->error))
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue