CodeIgniter Forums
File Uploading Class doesn't allow xlsx extension. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: File Uploading Class doesn't allow xlsx extension. (/showthread.php?tid=50293)



File Uploading Class doesn't allow xlsx extension. - El Forum - 03-21-2012

[eluser]Unknown[/eluser]
When i try to upload a xlsx file i recived the error "The type file is not allowed". Is this a bug?


My code:

Code:
$config['upload_path'] = './assets/uploads/files/seguimiento/';
$config['allowed_types'] = 'xls|xlsx';
$config['max_size'] = '2048';
$config['file_name'] = 'FS_'.$usuario->username;
$this->load->library('upload', $config);
  
  
if ( ! $this->upload->do_upload("documento") )
{
      $datos['mensaje'] = $this->upload->display_errors();

}



File Uploading Class doesn't allow xlsx extension. - El Forum - 03-21-2012

[eluser]CroNiX[/eluser]
check and make sure the mime types for those file types are correct in the application/config/mimes.php


File Uploading Class doesn't allow xlsx extension. - El Forum - 03-21-2012

[eluser]Unknown[/eluser]
I added application/zip to xlsx and it works.Thank you.

Code:
'xlsx' => array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip')

I dont know why xlsx file have this mime type.


File Uploading Class doesn't allow xlsx extension. - El Forum - 03-22-2012

[eluser]Narf[/eluser]
application/zip is already added to mimes.php in the current development version.