Quantcast
Channel: CodeIgniter Forums - All Forums
Viewing all articles
Browse latest Browse all 14115

trouble with file_mime_type() in upload.php

$
0
0

.jpg   Capture.JPG (Size: 20.51 KB / Downloads: 6) 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? 

Viewing all articles
Browse latest Browse all 14115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>