[eluser]Unknown[/eluser]
Hi, I use CodeIgniter 1.7.2,
i found that image check code (in is_allowed_filetype function, line 566) was not on the right place. This cause the "The filetype you are attempting to upload is not allowed" problem for non image file (xls, doc, pdf, etc).
image check code :
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
my solution was edit the libraries/upload.php, move the image check code to other place, see below
function is_allowed_filetype()
{
.
.
.
foreach ($this->allowed_types as $val)
{
$mime = $this->mimes_types(strtolower($val));
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
{
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
return TRUE;
}
}
else
.
.
.
}
Hope this solution will solved your problem