mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-18 04:31:06 +01:00
* Etemplate - Don't trust browsers mime if we don't have to - fixes incorrect mime types and Resources rejecting pictures
This commit is contained in:
parent
564a4cab5d
commit
f4e2230191
@ -147,10 +147,15 @@ class File extends Etemplate\Widget
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($file['error'] == UPLOAD_ERR_OK && trim($file['name']) != '' && $file['size'] > 0 && is_uploaded_file($file['tmp_name'])) {
|
if ($file['error'] == UPLOAD_ERR_OK && trim($file['name']) != '' && $file['size'] > 0 && is_uploaded_file($file['tmp_name'])) {
|
||||||
|
// Don't trust what the browser tells us for mime
|
||||||
|
if(function_exists('mime_content_type'))
|
||||||
|
{
|
||||||
|
$file['type'] = $type = mime_content_type($file['tmp_name']);
|
||||||
|
}
|
||||||
|
|
||||||
// Mime check
|
// Mime check
|
||||||
if($mime)
|
if($mime)
|
||||||
{
|
{
|
||||||
$type = $file['type'];
|
|
||||||
$is_preg = $mime[0] == '/';
|
$is_preg = $mime[0] == '/';
|
||||||
if (!$is_preg && strcasecmp($mime,$type) ||
|
if (!$is_preg && strcasecmp($mime,$type) ||
|
||||||
$is_preg && !preg_match($mime,$type))
|
$is_preg && !preg_match($mime,$type))
|
||||||
|
Loading…
Reference in New Issue
Block a user