Welcome Guest, Not a member yet? Register   Sign In
allow all filetypes upload
#5

[eluser]Colin Williams[/eluser]
application/libraries/MY_Upload.php

Code:
class MY_Upload {

        // --------------------------------------------------------------------
    
    /**
     * Verify that the filetype is allowed
     *
     * @access    public
     * @return    bool
     */    
    function is_allowed_filetype()
    {
        if (count($this->allowed_types) == 0 || ! is_array($this->allowed_types))
        {
            // Return TRUE instead of failing. I would recommend a more concrete way of allowing all file types
            return TRUE;
        }
                
        foreach ($this->allowed_types as $val)
        {
            $mime = $this->mimes_types(strtolower($val));
        
            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
allow all filetypes upload - by El Forum - 06-20-2008, 03:45 AM
allow all filetypes upload - by El Forum - 06-20-2008, 05:29 AM
allow all filetypes upload - by El Forum - 06-20-2008, 06:45 AM
allow all filetypes upload - by El Forum - 08-17-2008, 08:32 PM
allow all filetypes upload - by El Forum - 08-17-2008, 11:36 PM
allow all filetypes upload - by El Forum - 08-19-2008, 05:52 PM
allow all filetypes upload - by El Forum - 08-20-2008, 11:44 AM
allow all filetypes upload - by El Forum - 08-20-2008, 12:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB