Upload XML to Codeignter 3

Asked

Viewed 59 times

0

I am uploading to codeigniter 3 and it is not accepting xml to upload. It shows me an error that the selected file type is not allowed.

$config['upload_path']          = './uploads';
$config['allowed_types']        = 'xml';
$config['max_size']             = 0;
$config['max_width']            = 0;
$config['max_height']           = 0;
$config['encrypt_name']         = TRUE;

    $this->load->library('upload', $config);

    if ( ! $this->upload->do_upload('nota_fiscal'))
    {
        echo $this->upload->display_errors();
    }

My mimes.php file looks like this:

'xml'   =>  array('application/xml', 'text/xml', 'text/plain'),
  • Take a look: https://stackoverflow.com/questions/18366558/codeigniter-xml-file-not-uploading

  • I’ve seen this before and didn’t solve it, the mimes.php of codeigniter3 comes this way.

  • 2

    And if you replace in mimes this xml assignment for this: 'xml' => array('text/xml','application/xml','application/octet-stream') ?

  • I managed to make it work this way, thanks!!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.