-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Direction
function gussExtension return wrong result, return csv instead of right answer "txt" or "text";
Describe the bug
when txt,text files uploaded
if ($filelist = $this->request->getFiles()) {
var_dump($file->guessExtension());//return csv instead text
}
**why this happend** **because $mime['csv'] include 'text/plain' in file "application\Config\Mimes.php",so function always return csv when the input is ‘text/plain’**
public static function guessExtensionFromType(string $type = ‘text/plain’){
$type = trim(strtolower($type), '. ');
foreach (self::$mimes as $ext => $types)
{
if (is_string($types) && $types == $type)
{
return $ext;
}
else if (is_array($types) && in_array($type, $types))
{
return $ext;
}
}
return null;
}`
CodeIgniter 4 version
CodeIgniter 4 Development
Affected module(s)
system\Files
system\Files\File.php
application\Config\Mimes.php
Expected behavior, and steps to reproduce if appropriate
return file's correct mimetype
Context
- OS: [e.g. Windows 7]
- Web server [e.g. Apache 2.4]
- PHP version [7.1] with module php_fileinfo active
Metadata
Metadata
Assignees
Labels
No labels