Welcome Guest, Not a member yet? Register   Sign In
Upload Library Bug :: Allowed Types
#2

[eluser]abmcr[/eluser]
Thank you.... i also have found the bug but only in the 1.7.1. release
I post my MY_Upload library
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
*
*/
class My_Upload extends CI_Upload
{
    function My_Upload()
    {
        parent::CI_Upload();
    }

    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 ($this->is_image){    
                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;
    }
    

}
?>


Messages In This Thread
Upload Library Bug :: Allowed Types - by El Forum - 02-14-2009, 04:04 PM
Upload Library Bug :: Allowed Types - by El Forum - 02-15-2009, 04:11 AM
Upload Library Bug :: Allowed Types - by El Forum - 02-15-2009, 05:20 AM
Upload Library Bug :: Allowed Types - by El Forum - 02-15-2009, 11:29 AM
Upload Library Bug :: Allowed Types - by El Forum - 03-11-2009, 07:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB