[eluser]Unknown[/eluser]
I had problems when uploading files. with the error: "The filetype you are attempting to upload is not allowed.".
after I learned the cause. I changed the code Function is_allowed_filetype on upload.php file (library).
before :
Code:
function is_allowed_filetype()
{
if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types))
{
$this->set_error('upload_no_file_types');
return FALSE;
}
$image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
foreach ($this->allowed_types as $val)
{
$mime = $this->mimes_types(strtolower($val));
// Images get some additional checks
if (in_array($val, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
if (is_array($mime))
{
if (in_array($this->file_type, $mime, TRUE))
{
return TRUE;
}
}
else
{
if ($mime == $this->file_type)
{
return TRUE;
}
}
}
return FALSE;
}
changed :
Code:
function is_allowed_filetype()
{
if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types))
{
$this->set_error('upload_no_file_types');
return FALSE;
}
$image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');
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($this->file_type, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
return TRUE;
}
}
else
{
if ($mime == $this->file_type)
{
// Images get some additional checks
if (in_array($this->file_type, $image_types))
{
if (getimagesize($this->file_temp) === FALSE)
{
return FALSE;
}
}
return TRUE;
}
}
}
return FALSE;
}
probably not good writing structure. but my problem solved with that.
good luck.
BlackIT Community.