Welcome Guest, Not a member yet? Register   Sign In
xml upload mimetype error with IE8.
#1

[eluser]HdotNET[/eluser]
Hi all,

Came across this bug/problem today when trying to upload XML files using the CI Upload lib.

Seems everything <i>other</i> than IE8 is ok...

My controller:
Code:
$config['allowed_types'] = 'xml';
$config['overwrite'] = TRUE;
$config['max_size'] = 1000;
$this->load->library('upload', $config);

application/config/mimes.php << default that comes with CI 1.7.2, also the same in the SVN trunk
Code:
'xml'    =>    'text/xml',

uploading a test.xml file in IE8 gives a filetype not allowed error.

a print_r of $_FILES shows this:
Code:
Array
(
    [userfile] => Array
        (
            [name] => test.xml
            [type] => application/octet-stream
            [tmp_name] => /tmp/phpdz5MCS
            [error] => 0
            [size] => 407
        )

)

as opposed to this in anything other than IE8:

Code:
Array
(
    [userfile] => Array
        (
            [name] => test.xml
            [type] => text/xml
            [tmp_name] => /tmp/phpz6dUY7
            [error] => 0
            [size] => 407
        )

)

Note the difference in the 'type' element... fix is simple enough:

application/config/mimes.php
Code:
'xml'    =>    array('text/xml', 'application/octet-stream'),

Odd one that... would appreciate someone else having a go if they could... if anything just to prove that I'm not going mad.

tx

H




Theme © iAndrew 2016 - Forum software by © MyBB