Welcome Guest, Not a member yet? Register   Sign In
Mp3 Mime-type?
#5

[eluser]TheFuzzy0ne[/eluser]
For the cause:

./system/application/libraries/MY_Upload.php
Code:
<?php

class MY_Upload extends 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;
        }
                
        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;
                }    
            }        
        }
        # START EDIT #
        $log_file = BASEPATH . 'logs/unknown_mimes.log';
        $file_type = $this->file_type;
        echo $file_type . '<br />';
        if (file_exists($log_file))
        {
            $file = file($log_file);
            
            if ( ! $file_type)
            {
                $file_type = 'No Mime Type!';
            }
            else if ( ! in_array($file_type, $file))
            {
                $file[] = $file_type;
            }
            $file_type = implode("\n", $file);
            echo $file_type;
        }
        
        file_put_contents($log_file, $file_type);
        
        # END EDIT #
        return FALSE;
    }
}

// End of file: MY_Upload.php
// Location: ./system/application/libraries/MY_Upload.php
// End of file: MY_Upload.php
// Location: ./system/application/libraries/MY_Upload.php
The above code is tested and working.

This should log any unrecognised mime types to ./system/logs/unknown_mimes.log. It should only log any one mime once, so you won't have to sift through lots of lines.


Messages In This Thread
Mp3 Mime-type? - by El Forum - 03-09-2009, 02:19 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 04:00 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 04:05 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 04:49 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 04:58 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:07 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:09 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:11 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:11 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:17 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:20 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:21 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:23 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:30 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:33 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:41 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:44 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:45 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 05:49 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 06:11 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 07:19 PM
Mp3 Mime-type? - by El Forum - 03-09-2009, 07:33 PM
Mp3 Mime-type? - by El Forum - 03-11-2009, 08:14 PM
Mp3 Mime-type? - by El Forum - 03-11-2009, 08:27 PM
Mp3 Mime-type? - by El Forum - 03-11-2009, 08:29 PM
Mp3 Mime-type? - by El Forum - 03-11-2009, 08:43 PM
Mp3 Mime-type? - by El Forum - 03-11-2009, 09:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB