Welcome Guest, Not a member yet? Register   Sign In
File Upload Class - MIME type detection error - 2.1.0
#13

[eluser]Musaddiq Khan[/eluser]
Replace function is_allowed_filetype() in sysetem/libraries/Upload.php, It has worked for me.


Code:
public function is_allowed_filetype($ignore_mime = FALSE)
{
  if ($this->allowed_types == '*')
  {
   return TRUE;
  }
  //echo '$this->allowed types==>'.$this->allowed_types;
  if (count($this->allowed_types) == 0 OR ! is_array($this->allowed_types))
  {
   $this->set_error('upload_no_file_types');
   return FALSE;
  }

  $ext = strtolower(ltrim($this->file_ext, '.'));

  if ( ! in_array($ext, $this->allowed_types))
  {
   return FALSE;
  }

  // Images get some additional checks
  $image_types = array('gif', 'jpg', 'jpeg', 'png', 'jpe');

  if (in_array($ext, $image_types))
  {
   if (getimagesize($this->file_temp) === FALSE)
   {
    return FALSE;
   }
  }
  
  if ($ignore_mime === TRUE)
  {
   return TRUE;
  }
  $mime = $this->mimes_types($ext);
  
  if ($ext == 'png')
  {
   $mime[] = $ext;
   $this->file_type = $ext;
  }
  if (is_array($mime))
  {
   if (in_array($this->file_type, $mime, TRUE))
   {
    return TRUE;
   }
  }
  elseif ($mime == $this->file_type)
  {
    return TRUE;
  }

  return FALSE;
}


Messages In This Thread
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 11-17-2011, 01:35 PM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 04-16-2012, 09:42 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 04-19-2012, 12:08 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 05-16-2012, 08:42 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 05-17-2012, 10:35 PM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 06-27-2012, 10:59 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-06-2012, 02:39 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-17-2012, 11:52 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-22-2012, 10:21 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-22-2012, 11:53 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-23-2012, 01:42 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 08-27-2012, 04:34 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 09-11-2012, 12:12 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 09-12-2012, 01:00 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 09-20-2012, 02:30 PM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 07-17-2013, 11:46 AM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 11-20-2013, 09:29 PM
File Upload Class - MIME type detection error - 2.1.0 - by El Forum - 08-26-2014, 08:10 AM



Theme © iAndrew 2016 - Forum software by © MyBB