Welcome Guest, Not a member yet? Register   Sign In
trouble with file_mime_type() in upload.php
#1

(This post was last modified: 02-09-2018, 10:33 AM by richb201.)

    I've uploaded an xls file and I seem to be getting the wrong mime type for it. 

This is the line of trouble:

$mime = @finfo_file($finfo, $file['tmp_name']);

The $mime says that it is a "text/plain;charset=utf-16le" but the screenshot attached shows that it is actually a "vnd.ms-excel". After this it is all downhill. A few lines down (line 1241 of upload.php)

if (is_string($mime) && preg_match($regexp, $mime, $matches))
{
  $this->file_type = $matches[1];
  return;
}

This causes the file_type to be text when I am only allowing XLS | XLSX. 

Any ideas on what to do? 
proof that an old dog can learn new tricks
Reply


Messages In This Thread
trouble with file_mime_type() in upload.php - by richb201 - 02-09-2018, 10:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB